On 04/03/13 13:22, marty moore wrote: > long i = (long)(w->argument()); compiles, but always results in '0'. > Doesn't w point back to the Fl_Menu_Button that had the menu?
Probably depends on if you're setting the callback for the widget, or the callback for the items. Each item can have its own callback and userdata. Also, the Menu widget itself can also have its own callback + userdata. (The latter is used for items that have no callback of their own, IIRC.) If you're setting the callback for the widget, then w->userdata() should have any user_data() you'd set. But if you're setting the item's individual callbacks, then to access that item's userdata, your callback would have to first find the last item picked (with 'mvalue()') and then access its user_data(), eg: const Fl_Menu_Item *item = w->mvalue(); // get last picked item long i = (long)item->user_data(); // get user data for that item ..or something like that. _______________________________________________ fltk mailing list fltk@easysw.com http://lists.easysw.com/mailman/listinfo/fltk