RE: [fltk.general] Making a menu_bar submenu close when the menu_bar loses focus - [General Use]

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: Making a menu_bar submenu close when the menu_bar loses focus - [General Use] "MacArthur, Ian (Leonardo, UK)" 07:35 Sep 15 top right image
 
> 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.

This is pretty normal, though, many (most?) GUI toolkits do that; indeed I think that's the default behaviour for Win10.

However, the Win10 system menus, though they stay dropped down, will not usually block click events *that occur outside the menu area* from propagating to other widgets, whereas FLTK menus typically grab the context and so will prevent clicks from propagating, until the menu is dismissed.

It's a design choice, and it's hard to pick the *right* choice for every case. Remember that FLTK has to strive for some consistency across a range of different Window Manager environments, so it is tricky to please everybody!

 

> The only times it doesn't is if 
> 1) I pass the mouse over another menu item, in which case the second sub-menu drops down, or 
> 2) I click on the menu_bar away from any menu items.
> This has the effect that all other events in my app seem to be blocked, especially the app close event which is the most infuriating.

Yup - see above...

> I presume I need to handle the UNFOCUS event in the menu_bar, but how do I cause the sub-menu to close.

Well... I think in the past I faked this up on Windows by catching the LEAVE event in the menu handle() method, then generated a synthetic click at the mouse position (i.e. outside the menu.) Since the menu is grabbing the context anyway, that click goes nowhere, but does dismiss the menu.

That said, I just looked for a sample of that code and can not find it - it is likely on some machine I do not have access to right now...


> Alternaively I would like to generate a system noise alert that window close is being ignored.


Leonardo MW Ltd
Registered Office: Sigma House, Christopher Martin Road, Basildon, Essex SS14 3EL
A company registered in England & Wales.  Company no. 02426132
********************************************************************
This email and any attachments are confidential to the intended
recipient and may also be privileged. If you are not the intended
recipient please delete it from your system and notify the sender.
You should not copy it or use it for any purpose nor disclose or
distribute its contents to any other person.
********************************************************************

-- 
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/629d4d8060f14357a6ad150e34ae2a51%40leonardocompany.com.
Direct Link to Message ]
 
bottom left image   bottom right image
Previous Message ]New Message | Reply ]Next Message ]
 
 

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