Thanks Herman. I did have to use the main menu bar widget, but the mvalue() was 
wrong so I put the Fl_Menu_Item address as the user_data and I changed my 
callback to

 my_function( (bool)((Fl_Menu_Item*)v)->checked()) );

A note to FLTK developers. Please do not get rid of checked() or check(). I do 
not what else I could do. The menu items are very awkward to work with.


> Ok, reading your code examples again...
>
>   my_function( (bool)(o->mvalue()->value()) );
>
> This will work only - at least I think, without testing - if the user
> picked the menu item with the mouse. If you call do_callback() from the
> Menu_Item directly the parent Fl_Menu_ is not notified to adjust
> picked() and mvalue().
>
> The Fl_Menu_Item.H code uses do_callback() in a straight forward way: it
> just calls your defined callback with the provided widget and the
> user_data as arguments.
>
> The Fl_Menu_* you have to provide is the pointer to the menu in which
> you have defined your Menu_Item so that it finds the static callback, in
> your case by looking up  ((Controls*)(o->parent()->user_data())), where
> the pointer to the instance of the Fl_Menu_ class is stored.
>
> Just give the menu (probably Fl_Menu_Bar) a name in fluid and use this
> as an argument.
>
> I hope this helps.
>
> Cheers, Herman
>
>
>
> On 10/15/2012 02:11 PM, vigmond.ucalgary wrote:
> > I already looked there so I will keep on asking.
> >
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to