Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Toolkit Pro
  New Posts New Posts RSS Feed - Virtual key use in CompareAccelKey
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Virtual key use in CompareAccelKey

 Post Reply Post Reply
Author
Message
scdotss View Drop Down
Newbie
Newbie


Joined: 02 November 2007
Location: United States
Status: Offline
Points: 3
Post Options Post Options   Thanks (0) Thanks(0)   Quote scdotss Quote  Post ReplyReply Direct Link To This Post Topic: Virtual key use in CompareAccelKey
    Posted: 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?
 
Back to Top
Oleg View Drop Down
Senior Member
Senior Member


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
scdotss View Drop Down
Newbie
Newbie


Joined: 02 November 2007
Location: United States
Status: Offline
Points: 3
Post Options Post Options   Thanks (0) Thanks(0)   Quote scdotss Quote  Post ReplyReply Direct Link To This Post 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!
Back to Top
scdotss View Drop Down
Newbie
Newbie


Joined: 02 November 2007
Location: United States
Status: Offline
Points: 3
Post Options Post Options   Thanks (0) Thanks(0)   Quote scdotss Quote  Post ReplyReply Direct Link To This Post 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!
Back to Top
Oleg View Drop Down
Senior Member
Senior Member


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.063 seconds.