>
> >> I'd like to know from some of the more experienced users how they
> >> usually go about updating the children Widgets of a Window.
> >
> > Sorry if I wasn't clear.  By update, I mean modify, like calling
> > the child Widget's deactivate/activate/show/hide members.
> >
> > I'd like a simple way to choose a widget and call one of its members.
> > Putting the Widget's name in user_data and cycling through all the
> > widgets of a Window to find the one I want works, [...]
>
> It seems to me that you are making it more complicated than needed.
>
> The usual way of attacking this problem means that you either declare
> global variables corresponding the the widgets you are interested in,
> or you declare them as member variables of your own classes. Then
> you pass the pointer to the widget as the user data to the callback
> and then access the other widgets via the global variables, or you
> pass the _this_ pointer of the class as the user data to the callback
> and use this pointer in the callback to access the member widgets.
>
> You can also provide functions or member functions to get/set/update
> individual widgets or groups of related widgets.
>
> I'm afraid that I don't have time at the moment to provide an example
> but label.cxx, output.cxx and pixmap.cxx in the fltk-1.3/src/test
> directory use global variables for access to widgets. That might help.
>
> Cheers
> Duncan

Thanks Duncan,
I don't need an example, I subclassed Window and added members to point to 
Widgets the first time I did something like this.  Both methods seem to be a 
bit high in maintenance overhead though.  I was just hoping there was a 'name' 
field or something similar already in place to identify the Widget.

Just for clarity's sake, most of you are assuming that this is being done in 
one of the callbacks.  This is being done to update the state of the GUI due to 
changes outside the GUI.  Also, I'm the only (=20) person using flkt2 ;)

Cheers,

Jivan

_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to