[wxMac CVS HEAD] wxAccelerator Control vs Command?
Stefan Csomor
csomor at advancedconcepts.ch
Sun Aug 27 22:26:30 PDT 2006
Hi Ryan
thank you for pointing out this issue
> Today I was playing with wxAcceleratorTable. The wxBook(p.180) says:
> "Note that on OS X, a shortcut specification involving
> Ctrl will actually use the Command key"
>
> I tested this assertion out, and proved it false!
no the sentence is correct, in the paragraph it stands, it still relates
to the string of a menu command, like
"Copy\tCtrl+C"
But the same is not true with wxAcceleratorEntry. There the match is
different, rather a 1:1 for ctrl
> wxAcceleratorEntry *entry = node->GetData();
> if ((event.m_keyCode == entry->GetKeyCode()) &&
> (((entry->GetFlags() & wxACCEL_CTRL) == 0) ||
> event.ControlDown()) &&
> (((entry->GetFlags() & wxACCEL_SHIFT) == 0) ||
> event.ShiftDown()) &&
> (((entry->GetFlags() & wxACCEL_ALT) == 0) ||
> event.AltDown() || event.MetaDown()))
> {
> return entry->GetCommand();
> }
for accelerators it makes sense to me to have the 1:1 test, as you can
do with the wxKeyEvent, so I wouldn't interpret ctrl as meta on mac, but
of course sometimes you want to indicate even accelerator keys that
would be different on the platforms. IMHO the cleanest solutions would
be to offer a wxACCEL_CMD which would be META on mac and CTRL on other
platforms ?
Btw : there is no wxACCEL_META defines, should it be ?
Thoughts, opinions,
Stefan
More information about the wx-users
mailing list