Hi,
I am trying to figure out Down/Up state of 'Command' key on Mac and am using following statement:
::wxGetKeyState(WXK_COMMAND);
Although Command key is pressed, this returns false.
I am NOT using this in any of mouse key handler, but am using it in normal function. Is it still okay to use?
The keyboard which I am using is Standard 104 Keys Windows keyboard and Not Mac keyboard. And I am pressing Left-Windows key which is equivalent to Command key.
Should wxGetKeyState(WXK_COMMAND) work in above scenario?
wxWidgets Ver: 2.8
Mac OS X: 10.5.7
XCode: 3.0
Thanks,
Hardik
::wxGetKeyState(WXK_COMMAND) does Not work properly on Mac
-
- Earned a small fee
- Posts: 16
- Joined: Wed Apr 22, 2009 10:15 am
- Location: India
-
- Earned a small fee
- Posts: 16
- Joined: Wed Apr 22, 2009 10:15 am
- Location: India
Hi Auria,Auria wrote:Hi,
have you tried other keys? i.e. do all keys fail or only command?
In either case, I think this may well be worth a bug report.
hint: if what you're trying to do is get keyboard shortcuts to work, there's much easier/cleaner ways
Yes, I tried with other keys and they worked.
I think, I've found the solution! While debugging deep into wxWidgets library for Mac, I found that 'Command' key on Mac is tied up with WXK_MENU keycode, instead of WXK_COMMAND ?!!
See below:
../wxWidgets/src/mac/carbon/app.cpp
Code: Select all
int wxMacKeyCodeToModifier(wxKeyCode key)
{
switch (key)
{
case WXK_START:
case WXK_MENU:
return cmdKey;
case WXK_SHIFT:
return shiftKey;
case WXK_CAPITAL:
return alphaLock;
case WXK_ALT:
return optionKey;
case WXK_CONTROL:
return controlKey;
default:
return 0;
}
}
This should be corrected...
I got required functionality after calling wxGetKeyState(WXK_MENU) for 'Command' Key.
Thank you for your help and reply.
-Hardik.
i'm not sure if this is a bug. It's somewhat explained here, although they don't use WXK_MENU:
http://docs.wxwidgets.org/stable/wx_key ... ymodifiers
http://docs.wxwidgets.org/stable/wx_key ... ymodifiers
Use the source, Luke!
Well then it's a documentation bugdoublemax wrote:i'm not sure if this is a bug. It's somewhat explained here, although they don't use WXK_MENU:
http://docs.wxwidgets.org/stable/wx_key ... ymodifiers
"Keyboard not detected. Press F1 to continue"
-- Windows
-- Windows
-
- Earned a small fee
- Posts: 16
- Joined: Wed Apr 22, 2009 10:15 am
- Location: India
Well, I feel it's implementation bug as well.Auria wrote:Well then it's a documentation bugdoublemax wrote:i'm not sure if this is a bug. It's somewhat explained here, although they don't use WXK_MENU:
http://docs.wxwidgets.org/stable/wx_key ... ymodifiers
Since there is already a define WXK_COMMAND in the library, it should be mapped for Command Key rather than any other keys.
I will be glad to fix this in wxWidgets library, if I am allowed to do this. If you agree that, this qualify for a fix, please guide me where to log a bug and find the library code.
Thanks,
Hardik
See http://trac.wxwidgets.org/ for bug reports and patch submission
As for where to find the wxWidgets code, a quick google or lurking around wxwidgets.org will sure tell you quickly enough
As for where to find the wxWidgets code, a quick google or lurking around wxwidgets.org will sure tell you quickly enough
"Keyboard not detected. Press F1 to continue"
-- Windows
-- Windows