From d0a68715f3326ff08be577c102f6d263bc429817 Mon Sep 17 00:00:00 2001 From: Christophe Geuzaine <cgeuzaine@ulg.ac.be> Date: Wed, 11 Mar 2015 13:21:02 +0000 Subject: [PATCH] hide widgets to make sure they don't get events when they are removed from the tree, but have not yet been deleted --- Fltk/onelabGroup.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Fltk/onelabGroup.cpp b/Fltk/onelabGroup.cpp index 02561263f2..a7c8514eb5 100644 --- a/Fltk/onelabGroup.cpp +++ b/Fltk/onelabGroup.cpp @@ -529,6 +529,7 @@ void onelabGroup::_addParameter(T &p) void onelabGroup::_addMenu(const std::string &path, Fl_Callback *callback, void *data) { Fl_Tree_Item *n = _tree->add(path.c_str()); + //n->labelsize(FL_NORMAL_SIZE + 4); _tree->begin(); int ww = _baseWidth - (n->depth() + 1) * _indent; int hh = n->labelsize() + 4; @@ -1019,6 +1020,11 @@ void onelabGroup::rebuildTree(bool deleteWidgets) _tree->sortorder(FL_TREE_SORT_ASCENDING); _tree->selectmode(FL_TREE_SELECT_NONE); + // hide all the widgets we have added in the tree to make sure they don't get + // spurious events (until they are deleted) + for(unsigned int i = 0; i < _treeWidgets.size(); i++) + _treeWidgets[i]->hide(); + // we don't delete widgets everytime the tree is rebuilt to minimize potential // race conditions (e.g. during heavy user interaction with autoCheck, with // risks to call handle() or focus() on deleted widgets) -- GitLab