> There's at least three ways to do this, in order of preference: > > #1 Make a class, make the three widgets members of the class, > and refer to them in your callback, passing the class's own pointer > as the 'userdata'. > > #2 Use globals for all the widgets, and refer to them in your callback > so that you don't have to pass them. > > #3 Make a struct, putting all three widget pointers in the struct, > and make the 'user data' a pointer to the struct, so that the > callback can access all three widgets in the struct. > > See this video tutorial on FLTK which shows #2 first, then #1 second: > http://seriss.com/people/erco/fltk-videos/tutorial-fltk-hello.html > I think that will help you. > > Note that the Fl_Widget passed as the first argument will always be > the widget invoked by the callback only. No matter how you cast it, > that's what it will be. And the second argument, the void *userdata > will be whatever was set as the userdata when you set the callback > for that widget. >
Cool!Thanks Greg! The struct method never came in mind, that's smart too.Similar to class. _______________________________________________ fltk mailing list [email protected] http://lists.easysw.com/mailman/listinfo/fltk

