|
|
I went through this conundrum myself recently.
Here is my callback:
void cb_ShowPreview(Fl_Widget *w, void *) { const Fl_Menu_Item *mi = ((Fl_Menu_ *)w)->mvalue(); auto v = mi->checked(); togglePreview(v != 0); }
As you can hopefully see, the widget passed to the callback is the MENU, not the MENU-ITEM.
I have a Fl_Menu_Button with some menu items inside it. The menu items look like this:{ {"label", 0, reinterpret_cast<Fl_Callback*>(callback), 0, FL_MENU_TOGGLE}, {nullptr}} ...
For whatever reason, it always returns FL_MENU_VALUE (4), regardless of whether I checked or unchecked the box. From the docs it says it should return 0 if the item is not checked. Where have I gone wrong?
--
You received this message because you are subscribed to the Google Groups "fltk.general" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fltkgeneral+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/fltkgeneral/6ce8ca07-19f1-4556-a114-821a6e9fd647n%40googlegroups.com.
[ Direct Link to Message ] | |
|
| |