FLTK logo

Re: [fltk.general] How do you disable a button?

FLTK matrix user chat room
(using Element browser app)   FLTK gitter user chat room   GitHub FLTK Project   FLTK News RSS Feed  
  FLTK Apps      FLTK Library      Forums      Links     Login 
 All Forums  |  Back to fltk.general  ]
 
Previous Message ]New Message | Reply ]Next Message ]

Re: How do you disable a button? Albrecht Schlosser Jan 13, 2022  
 
On 1/13/22 12:38 PM 'Mark' via fltk.general wrote:
I have a "history" menubutton that I want to enable when the menu has items and disable when it doesn't.

Just to make sure we agree in what we're saying: In FLTK terminology this would be a menu item (Fl_Menu_Item) and the "items" you're talking about (the list of recent files, below) would be submenu items. There's also a widget called Fl_Menu_Button but that's a button that can pop up a menu when clicked.

I assume you're implementing a normal menu (Fl_Menu or Fl_Menu_Bar) with a submenu of recent files.

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.

Again, "buttons" = Fl_Menu_Items?

I've tried setting the trigger to none but that didn't do it. I also tried calling deactivate but that didn't stop clicking it from working.

"Setting the trigger" is not a FLTK term. What exactly did you try? Exact code (statements, not full program) would be much more helpful so we can better help you.

That said, you must disable the particular Fl_Menu_Item which is described here:
https://fltk.gitlab.io/fltk/structFl__Menu__Item.html#a3d531242e84a7bf8ee27482052f673a5

So maybe fltk has a way of doing this using terminology/functions I'm unfamiliar with? (I'm pretty new to fltk; I'm much more familiar with Tk, Qt, and wxWidgets.)

The terminology used in such cases is usually "activate" and "deactivate" (widgets/buttons, menu items, whatever). Sometimes enable and disable is used as well.

--
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/06c04db8-c6cf-c6b3-b1e7-21604ef289ec%40online.de.
Direct Link to Message ]
 
     
Previous Message ]New Message | Reply ]Next Message ]
 
 

Comments are owned by the poster. All other content is copyright 1998-2024 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to 'erco@seriss.com'.