From: Greg Ercolano
Sent: 15 September 2020 16:15
To: fltkgeneral@googlegroups.com
Subject: Re: [fltk.general] Making a menu_bar submenu close when the menu_barloses focus
On 2020-09-15 05:11, 'pvr...@btinternet.com' via fltk.general wrote:
> When I open a top-level sub-menu in my Fl_Menu_Bar I then find that it stays
> dropped down when I move focus away from the menu_bar.
Sounds like perfectly normal behavior to me.
I get the same behavior from the menubars for e.g. Firefox on Win7, Linux and Mac
(just checked) and even Windows 7's own file browser menubar.
I don't know if Win10 is different.
> Alternaively I would like to generate a system noise alert that window close is being ignored.
By "window close" do you mean the "X" to close the window, and want to ignore it?
If so, make a callback for the window (which will be called when the "X" is clicked)
and invoke whatever Win10 API call is needed to generate the system sound effect,
then simply return from the callback to prevent the window from closing.
(If you wanted the window to close, you'd just call e.g. exit(0);)
Thanks Greg, I catch the “X to close” event normally. I am not seeing it as the menu item has the focus. So I don’t think this will help.
Phil