wxMenu Automatic Global Accelerators

10 views
Skip to first unread message

bob pitbull

unread,
Oct 29, 2010, 9:52:16 AM10/29/10
to wx-u...@googlegroups.com
Hey All,

So... we have a menu item defined using lines like:-

EditMenu->Append( IDM_DELETE, "Delete\tDel", "" );

and

EVT_MENU( IDM_DELETE, WXED::Menu_Edit_Delete )

The issue that we're having, though, is that we don't want the Del key to be overridden always... sometimes we'll be in a different mode and want to treat it differently through an InputKey() function ... but the "\tDel" part essentially stops us from intercepting the Delere key in InputKey()...

Basically... is there a way to get the display functionality of \tDel (ie. to have the help text to the right of the wxMenu item) without it adding a global accelerator...?

Hope this makes sense - I don't 100% understand the code myself yet.

Bob

Vadim Zeitlin

unread,
Oct 30, 2010, 3:11:56 PM10/30/10
to wx-u...@googlegroups.com
On Fri, 29 Oct 2010 06:52:16 -0700 (PDT) bob pitbull <bob_p...@yahoo.com> wrote:

bp> So... we have a menu item defined using lines like:-
bp>
bp> EditMenu->Append( IDM_DELETE, "Delete\tDel", "" );
bp>
bp> and
bp>
bp> EVT_MENU( IDM_DELETE, WXED::Menu_Edit_Delete )
bp>
bp> The issue that we're having, though, is that we don't want the Del key to be
bp> overridden always...

In wxMSW you can override wxWindow::MSWTranslateMessage() to prevent this
accelerator from being handled if some condition is true, however we don't
have any portable solution to this problem.

Regards,
VZ

--
TT-Solutions: wxWidgets consultancy and technical support
http://www.tt-solutions.com/

bob pitbull

unread,
Nov 1, 2010, 9:25:00 AM11/1/10
to wx-u...@googlegroups.com
Just to double-check with this...

Is there no way to have a wxMenu item display an accellerator without actually adding it as a global accellerator? Ie. rather than using \tDel, I would have some other way of adding the "Del" part and having it right-justify in the menu item..?


From: Vadim Zeitlin <va...@wxwidgets.org>
To: wx-u...@googlegroups.com
Sent: Sat, 30 October, 2010 20:11:56
Subject: Re: wxMenu Automatic Global Accelerators

Vadim Zeitlin

unread,
Nov 2, 2010, 6:03:16 AM11/2/10
to wx-u...@googlegroups.com
On Mon, 1 Nov 2010 06:25:00 -0700 (PDT) bob pitbull <bob_p...@yahoo.com> wrote:

bp> Is there no way to have a wxMenu item display an accellerator without
bp> actually adding it as a global accellerator? Ie. rather than using
bp> \tDel, I would have some other way of adding the "Del" part and having
bp> it right-justify in the menu item..?

No, there is no way to do it (and IMO it's a good thing, if you could do
this it would be very confusing/misleading for the user).

Reply all
Reply to author
Forward
0 new messages