RE: [fltk.general] Making a menu_bar submenu close when the menu_barloses 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_barloses focus - [General Use] "MacArthur, Ian (Leonardo, UK)" 08:38 Sep 15 top right image
> > > 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...

OK, but I was clicking outside the menu – on the X at the top right of  the window.

I just ran up the menubar demo from the test folder, and what I see is...

- I drop down one of the menus, and do not dismiss it

- I click somewhere outside the menu, (including on the Red-X) and the menu is dismissed (but the click is not otherwise actioned)

- I click again in the same place, the click event is actioned.

Overall, that's what I'd expect: that first click on the "red-X" is not actioned because the menu had grabbed the context, but that does cause the menu to close. A second click then actions the "red-X" and the app terminates normally.

What behaviour do you see in your app?

Is it different from the behaviour of the menubar demo.? If so, the callback you have attached to the "red-X" may be complicating matters?

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
To view this discussion on the web visit
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 ''.