[wx-users] Trapping wxMouse events over wxMenus

13 views
Skip to first unread message

William Bozitski

unread,
Mar 8, 2001, 5:04:00 PM3/8/01
to wxwindo...@lists.sourceforge.net
Dear Fellow wxWindows users,

As a member of a team of new wxWindows users who are
currently developing a simple IDE, I am responsible
for the menu editor.

While the wxMenu class was intuitive and quickly
learned, there seems to be a problem trapping or
overiding mouse events while the focus is on a wxMenu.

Ideally, I would like to be able to left-click and
right-click WITHOUT the menu disappearing. These
wxMouse events would then trigger either a pop-up menu
or be used to display properties of the particular
wxMenu item that was selected.

The problem is that as soon as any menu item is
clicked on, the menu disappears. This makes it
difficult to visualize the whole menu and requires
that the menu bar be clicked again to redisplay the
menu.

I have tried deriving classes from wxMenu and
wxMenuBar to handle these mouse events and have even
tried to tack-on separate event handlers to intercept
eveything. No success. (Yet?)

Suggestions anyone?

-busted...@yahoo.ca

_______________________________________________________
Do You Yahoo!?
Get your free @yahoo.ca address at http://mail.yahoo.ca

_______________________________________________
wxWindows-users mailing list
wxWindo...@lists.sourceforge.net
http://lists.sourceforge.net/lists/listinfo/wxwindows-users


Vadim Zeitlin

unread,
Mar 8, 2001, 6:03:29 PM3/8/01
to wxwindo...@lists.sourceforge.net
On Thu, 8 Mar 2001, William Bozitski wrote:

> Ideally, I would like to be able to left-click and
> right-click WITHOUT the menu disappearing.

This is impossible under the two main platforms: MSW and GTK. Menus grab
the mouse when popped up (down?) and so all mouse events go to them.

> Suggestions anyone?

I don't really understand what the problem is... What you seem to want to
do goes against the usual GUI practice so the obvious question is why do
you want to do this? In any case, you just can't keep the menu popped up.

Under GTK you can create the menu with TEAROFF style and then tear it off
the menu bar and make a (permanently shown) separate window. Is this what
you're looking for? But this doesn't work under MSW... There the closest
alternative you have is to make a wxMiniFrame containing a toolbar with
text buttons.

Regards,
VZ

Manuel Martín

unread,
Mar 9, 2001, 8:38:55 AM3/9/01
to wxwindo...@lists.sourceforge.net
William Bozitski wrote:
> Ideally, I would like to be able to left-click and
> right-click WITHOUT the menu disappearing. These
> wxMouse events would then trigger either a pop-up menu
> or be used to display properties of the particular
> wxMenu item that was selected.

An idea:
If your problem is due to using menus, don´t use them.
I think that what you want is something like an interactive-help
Ok. Make a wxMenu to offer this subject. Make it to display a window
(dialog-style) where you SIMULATE the menu bar.
When user clicks on the simulated menu, you do the actions you want,
even sending to the Frame a real menu command event.

Other idea is to see if mouse is over the menu bar before users clicks
on it, and display the dialog like a tool-tip. But I think this will
make the aplication hard to use.

I hope this will be helpfull.

Manuel Martín

William Bozitski

unread,
Mar 9, 2001, 3:44:33 PM3/9/01
to wxwindo...@lists.sourceforge.net
Manuel:

--- Manuel Martín <mma...@ceyd.es> wrote:
> An idea:
> If your problem is due to using menus, don´t use
> them.

> When user clicks on the simulated menu, you do the
> actions you want,

> I hope this will be helpfull.

Thank you very much for your prompt reply. It seems
that it is impossible to override the wxMenu's native
functionality.

Curently, I am taking your advise and designing a
bunch of static text that will look and act like a
wxMenu, but won't be.

And yes, your suggestion is very helpful.

With appreciation,
busted...@yahoo.ca


_______________________________________________________
Do You Yahoo!?
Get your free @yahoo.ca address at http://mail.yahoo.ca

_______________________________________________

Reply all
Reply to author
Forward
0 new messages