On 1/13/22 3:38 AM, 'Mark' via
I have a "history" menubutton that I want to enable when the
menu has items and disable when it doesn't. It will start out
with no entries and gradually they'll be added depending on what
the user does. Similarly, I have other buttons which should be
enabled/disabled depending on context.
If it's a widget, e.g. Fl_Menu_Button, all widgets
derive from Fl_Widget where you'll find
methods like deactivate() (which disables and grays-out
the widget), and activate().
Also show() and hide() which can make a widget
That should affect the entire menu button, deactivating it from
If however you're trying to deactivate individual menu items or
that's different; you might use e.g. menubutton->find_item("item
to find the Fl_Menu_Item, and then call item->deactivate()
to deactivate it. e.g.
Fl_Menu_Item *item =
I've tried setting the trigger to none but that didn't do it.
Whether or not a widget (or menu item) has a callback()
doesn't affect its visible attributes.
At least not in FLTK, as some buttons/menu items have state that
can be polled and not need
a callback. Also with menus, individual items can leave their
callbacks unset, and just set a
callback for the whole menu, which can be used to determine
which item was clicked.
I also tried calling deactivate but that didn't stop
clicking it from working.
Hmm, that should have worked. But see above.
If that advice doesn't work, we might have to see your code to
determine what's wrong.
Try making a small simple compilable program that creates a
window + menubutton
and then call deactivate() the way you are doing it now, and if
it doesn't work, show us the code.
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 firstname.lastname@example.org.
To view this discussion on the web visit https://groups.google.com/d/msgid/fltkgeneral/1d59e9f9-139f-5b4c-9a3a-49bdf734cba7%40seriss.com.
[ Direct Link to Message ]