Menu

#90 FXApp::getKeyState not working in Windows

open
nobody
None
5
2006-10-02
2006-10-02
No

The function getKeyState has the next implementation:

// Return key state
bool FXApp::getKeyState(FXuint keysym) const {
#ifdef WIN32
return GetKeyState(keysym)!=0;
#else
KeyCode
keycode=XKeysymToKeycode((Display*)display,keysym);
char keys[32];
if(keycode==NoSymbol) return false;
XQueryKeymap((Display*)display,keys);
return (keys[keycode>>3]>>(keycode&7))&1;
#endif
}

As you see there is no a Keycode translation between
the FOX and the Windows version.
IE: In FOX the left control key has a keycode of

KEY_Control_L = 0xFFE3

But when you pass this to the getKeyState function, it
will not work because in Winsdows it has a different
keycode:

#define VK_LCONTROL 0xA2

It is needed a conversion prior to call the Windows
GetKeyState.

Discussion


Log in to post a comment.

MongoDB Logo MongoDB