From df16bd451911734119ddefe8efea71f71db14abc Mon Sep 17 00:00:00 2001 From: Christophe Geuzaine <cgeuzaine@ulg.ac.be> Date: Mon, 24 Jun 2013 13:41:34 +0000 Subject: [PATCH] better treatment of ReadOnly if binary choice or enumeration --- Fltk/onelabGroup.cpp | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/Fltk/onelabGroup.cpp b/Fltk/onelabGroup.cpp index da18acb116..098ce28541 100644 --- a/Fltk/onelabGroup.cpp +++ b/Fltk/onelabGroup.cpp @@ -1277,17 +1277,6 @@ Fl_Widget *onelabGroup::_addParameterWidget(onelab::number &p, Fl_Tree_Item *n, char *path = strdup(getPath(n).c_str()); _treeStrings.push_back(path); - // non-editable value - if(p.getReadOnly()){ - outputRange *but = new outputRange(1, 1, ww, 1); - but->callback(onelab_number_output_range_cb, (void*)path); - but->value(p.getValue()); - but->align(FL_ALIGN_RIGHT); - but->graph(p.getAttribute("Graph")); - if(highlight) but->color(c); - return but; - } - // enumeration (display choices as value labels, not numbers) if(p.getChoices().size() && p.getChoices().size() == p.getValueLabels().size()){ @@ -1313,6 +1302,7 @@ Fl_Widget *onelabGroup::_addParameterWidget(onelab::number &p, Fl_Tree_Item *n, } but->callback(onelab_number_choice_cb, (void*)path); but->align(FL_ALIGN_RIGHT); + if(p.getReadOnly()) but->deactivate(); return but; } @@ -1326,6 +1316,18 @@ Fl_Widget *onelabGroup::_addParameterWidget(onelab::number &p, Fl_Tree_Item *n, but->value(p.getValue()); but->callback(onelab_number_check_button_cb, (void*)path); if(highlight) but->color(c); + if(p.getReadOnly()) but->deactivate(); + return but; + } + + // non-editable value + if(p.getReadOnly()){ + outputRange *but = new outputRange(1, 1, ww, 1); + but->callback(onelab_number_output_range_cb, (void*)path); + but->value(p.getValue()); + but->align(FL_ALIGN_RIGHT); + but->graph(p.getAttribute("Graph")); + if(highlight) but->color(c); return but; } -- GitLab