From f07eec86ebecd673f42e1604dc32a5e5200eeb24 Mon Sep 17 00:00:00 2001
From: Francois Henrotte <francois.henrotte@ulg.ac.be>
Date: Thu, 21 Jun 2012 11:19:01 +0000
Subject: [PATCH]

---
 Common/GmshMessage.cpp | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/Common/GmshMessage.cpp b/Common/GmshMessage.cpp
index a1c6a5b0cf..9e9952ecd8 100644
--- a/Common/GmshMessage.cpp
+++ b/Common/GmshMessage.cpp
@@ -650,10 +650,7 @@ void Msg::ExchangeOnelabParameter(const std::string &key,
   _onelabClient->get(ps, name);
   bool noRange = true, noChoices = true, noLoop = true, noGraph = true;
   if(ps.size()){
-    if(ps[0].getReadOnly())
-      ps[0].setValue(val[0]); // use value from gmsh (so it is updated if necessary)
-    else
-      val[0] = ps[0].getValue(); // use value from server
+    val[0] = ps[0].getValue(); // always use value from server
     // keep track of these attributes, which can be changed server-side
     if(ps[0].getMin() != -onelab::parameter::maxNumber() ||
        ps[0].getMax() != onelab::parameter::maxNumber() ||
@@ -686,7 +683,13 @@ void Msg::ExchangeOnelabParameter(const std::string &key,
     if(copt.count("Choices")) ps[0].setChoiceLabels(copt["Choices"]);
   }
   if(fopt.count("Visible")) ps[0].setVisible(fopt["Visible"][0] ? true : false);
-  if(fopt.count("ReadOnly")) ps[0].setReadOnly(fopt["ReadOnly"][0] ? true : false);
+  if(fopt.count("ReadOnly")) {
+    ps[0].setReadOnly(fopt["ReadOnly"][0] ? true : false);
+    // If the parameter is set "read-only" here,
+    // the local value is used instead of that from the server
+    if(ps[0].getReadOnly())
+      ps[0].setValue(val[0]); 
+  }
   if(copt.count("Help")) ps[0].setHelp(copt["Help"][0]);
   if(copt.count("Label")) ps[0].setLabel(copt["Label"][0]);
   if(copt.count("ShortHelp")) ps[0].setLabel(copt["ShortHelp"][0]);
-- 
GitLab