Generate correct events for extended keys in wxMSW wxUIActionSimulator.

Simulating keys such as WXK_END resulted in WXK_NUMPAD_END event being
generated instead of the expected WXK_END one.

Fix this by returning from wxCharCodeWXToMSW() whether the key code is a
normal or extended one and use this to set KEYEVENTF_EXTENDEDKEY in
wxUIActionSimulator::DoKey().

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65518 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2010-09-11 10:18:25 +00:00
parent 9cbe96d093
commit 2dcbc4615b
3 changed files with 35 additions and 5 deletions

View File

@@ -74,8 +74,16 @@ bool wxUIActionSimulator::MouseUp(int button)
bool
wxUIActionSimulator::DoKey(int keycode, int WXUNUSED(modifiers), bool isDown)
{
DWORD vkkeycode = wxCharCodeWXToMSW(keycode);
keybd_event(vkkeycode, 0, isDown ? 0 : KEYEVENTF_KEYUP, 0);
bool isExtended;
DWORD vkkeycode = wxCharCodeWXToMSW(keycode, &isExtended);
DWORD flags = 0;
if ( isExtended )
flags |= KEYEVENTF_EXTENDEDKEY;
if ( !isDown )
flags |= KEYEVENTF_KEYUP;
keybd_event(vkkeycode, 0, flags, 0);
return true;
}