popup menu item event?

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

popup menu item event?

bradcan
Is it possible to get a menu event when a submenu title is clicked, eg view or constraints?

In the attached image I want an event from a click on green shaded 'view' item. I can get events from all others. Clicking 'view' hides and shows the submenu alternately. I've tried binding mouse events to the item, but to no avail.

TIA

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.

menu.png (14K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: popup menu item event?

Tim Roberts
[hidden email] wrote:
>
> Is it possible to get a menu event when a submenu title is clicked, eg
> view or constraints?
>
> In the attached image I want an event from a click on green shaded
> 'view' item. I can get events from all others. Clicking 'view' hides
> and shows the submenu alternately. I've tried binding mouse events to
> the item, but to no avail.

This is what EVT_MENU_OPEN is for.  You can do this:

    self.Bind(wx.EVT_MENU_OPEN, self.menuOpen)

That will get fired every time a menu or submenu is about to be opened. 
You can query the event object to figure out which one it is.

--
Tim Roberts, [hidden email]
Providenza & Boekelheide, Inc.

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: popup menu item event?

bradcan
In reply to this post by bradcan


On Thursday, June 14, 2018 at 1:52:02 PM UTC+1, [hidden email] wrote:
Is it possible to get a menu event when a submenu title is clicked, eg view or constraints?

In the attached image I want an event from a click on green shaded 'view' item. I can get events from all others. Clicking 'view' hides and shows the submenu alternately. I've tried binding mouse events to the item, but to no avail.

TIA

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: popup menu item event?

bradcan
In reply to this post by bradcan
Yes EVT_MENU_OPEN for the sub menus works perfectly.

As Tim states the event occurs on the sub opening. So what I actually need is EVT_MENU_CLOSE which occurs as the item is left clicked.

Kudos for Tim Roberts

On Thursday, June 14, 2018 at 1:52:02 PM UTC+1, [hidden email] wrote:
Is it possible to get a menu event when a submenu title is clicked, eg view or constraints?

In the attached image I want an event from a click on green shaded 'view' item. I can get events from all others. Clicking 'view' hides and shows the submenu alternately. I've tried binding mouse events to the item, but to no avail.

TIA

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.