![]() |
Problem reserving accelerator keys |
Post Reply
|
| Author | |
jansim
Groupie
Joined: 03 November 2005 Location: Canada Status: Offline Points: 20 |
Post Options
Thanks(0)
Quote Reply
Topic: Problem reserving accelerator keysPosted: 16 October 2006 at 4:47pm |
|
I try to override the OnPreviewEditKey method from the shortcut manager to prevent the user fomr using some accelerators that conflicts with our built-in ones. Here it is the "Home" Key. When the method is first called ( from the WM_KEYDOWN ), I receive the ACCEL struct with a fVirtKey, meaning that the key pressed is a virtual key-code. I return false if the key is VK_HOME. It works fine so far.
The problem is that the method is called a second time ( for the WM_KEYUP ) and this time, the fVirtKey is not set to TRUE. Therefore I cannot say that the key depressed is "HOME", since the non virtual key code equivalent to "Home" is "$", and I don't want to forbid that key.
The problem is the following, when the "HOME" key is depressed, the Preview Key mecanism thinks the user just depressed "$" and sets the EditBoxText to "$".
The problem happens to the VK_ESCAPE key you are blocking. But you don't see the bug since the non-virtual equivalent to "Escape" is not a displayable character.
Thanks
Jansim
|
|
![]() |
|
Oleg
Senior Member
Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
Quote Reply
Posted: 18 October 2006 at 1:00am |
|
Hello, you right. Please modify sources:
if (pMsg->wParam == VK_SHIFT
|| pMsg->wParam == VK_CONTROL || pMsg->wParam == VK_MENU ) { // all work is already done }else if (bPressed) { m_hAccel.key = (WORD) pMsg->wParam; m_bKeyDefined = TRUE; SetAccelFlag (FVIRTKEY, TRUE); } |
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
![]() |
|
jansim
Groupie
Joined: 03 November 2005 Location: Canada Status: Offline Points: 20 |
Post Options
Thanks(0)
Quote Reply
Posted: 18 October 2006 at 9:52am |
|
Thank you
|
|
![]() |
|
Post Reply
|
|
|
Tweet
|
| Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |