![]() |
Virtual key use in CompareAccelKey |
Post Reply
|
| Author | |
scdotss
Newbie
Joined: 02 November 2007 Location: United States Status: Offline Points: 3 |
Post Options
Thanks(0)
Quote Reply
Topic: Virtual key use in CompareAccelKeyPosted: 02 November 2007 at 4:36pm |
|
Here's the situation - We add items to the File menu for the last 9 Most Recently Used file (MRU), with shortcuts of 1,2....
If I hit the Alt-F + the 1 key from the main keyboard (above the Q), it will use the file name of the first item in the MRU.
But, if I hit the Alt-F + the 1 key from the numeric keypad, it will not do anything.
Tracking it down, it looks like there might be a problem in CXTPShortcutManager::CompareAccelKey().
TCHAR tchVirtualKey = (TCHAR)MapVirtualKey(wParam, 2);
if (tchVirtualKey == NULL) return FALSE; TCHAR chAccelUpper = ToUpper(chAccel);
if ((chAccel == (TCHAR)wParam) || (chAccelUpper == (TCHAR)wParam))
return TRUE; What I see is that the numeric keypad '1' is correctly mapped from a virtual key to the '1' character. But, this mapped value is never used for comparisons in the code, it always compares against the actual key that comes in. Thus the 1 key on the numeric keypad will never activate our MRU item.
If I add:
if ((chAccel == tchVirtualKey ) || (chAccelUpper == tchVirtualKey ))
return TRUE; then it seems to work OK for both the '1' key and the numeric keypad '1' key.
Is this a bug?
|
|
![]() |
|
Oleg
Senior Member
Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
Quote Reply
Posted: 05 November 2007 at 1:55am |
|
Hello,
Strange it works for me.
What Locale do you have? Do you use English input language ?
|
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
![]() |
|
scdotss
Newbie
Joined: 02 November 2007 Location: United States Status: Offline Points: 3 |
Post Options
Thanks(0)
Quote Reply
Posted: 05 November 2007 at 11:07am |
|
Yes, we use English as a language.
I've seen this not only on my computers (Vista, and XP) but others in our company have also seen it (and reported the actions as a defect to me).
Strange that it would work for you. Do you have a small test application that I could build and run on this machine to see if there are any differences?
Thanks!
|
|
![]() |
|
scdotss
Newbie
Joined: 02 November 2007 Location: United States Status: Offline Points: 3 |
Post Options
Thanks(0)
Quote Reply
Posted: 08 November 2007 at 4:19pm |
|
As I was working with some of the sample apps looking to add some additional functionality to our product, I simply added one '&1' shortcut to a menu item that previously had none.
And I was able to reproduce this defect. I can use the ALT-F to get the file menu, then '1' using the upper keyboard '1' key. But am unable to get the item to fire using the numeric keypad. I've seen this on many computers here at our offices. I believe it is a bug in the Toolkit. Is there any way to find out some resolution of this? Thanks! |
|
![]() |
|
Oleg
Senior Member
Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
Quote Reply
Posted: 09 November 2007 at 1:00am |
|
Hello,
Please patch first lines of CompareAccelKey method:
BOOL CXTPShortcutManager::CompareAccelKey(TCHAR chAccel, UINT wParam)
{ if (wParam >= VK_NUMPAD0 && wParam <= VK_NUMPAD9) return (UINT)chAccel == (wParam + '0' - VK_NUMPAD0); ...
and rebuild toolkit.
Thanks.
|
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
![]() |
|
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 |