Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Command Bars
  New Posts New Posts RSS Feed - [solved] BeforeAdd Id parameter 2-byte integer
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

[solved] BeforeAdd Id parameter 2-byte integer

 Post Reply Post Reply
Author
Message
wrecks View Drop Down
Groupie
Groupie


Joined: 14 July 2015
Status: Offline
Points: 42
Post Options Post Options   Thanks (0) Thanks(0)   Quote wrecks Quote  Post ReplyReply Direct Link To This Post Topic: [solved] BeforeAdd Id parameter 2-byte integer
    Posted: 03 April 2017 at 7:59am
For a Codejock CommandBars 17.2 Ribbon, I have been using numbers like 12300004 as my control Id numbers.  Everything is working fine until I tried to implement the Customize Keyboard facility.  When the BeforeAdd event fires, I get an Id of 44772, which did not match any of my Ids, and had no effect when I passed it along to KeyBindings.Add.  Now I realize that 44772 is the lower 2 bytes of 12300004 !  

Can you confirm that this is correct?  So I must use Id numbers < 65536 ?


Also, the BeforeAdd event Control, Shift, and Alt flags are unexpected.

For example, if I press Alt+0, I get fVirt=17 and Key=48.
The way I read the documentation, I was expecting fVirt=16.
Can you explain the extra 1 ?
Back to Top
olebed View Drop Down
Admin Group
Admin Group


Joined: 01 July 2014
Location: Ukraine
Status: Offline
Points: 841
Post Options Post Options   Thanks (0) Thanks(0)   Quote olebed Quote  Post ReplyReply Direct Link To This Post Posted: 03 April 2017 at 3:17pm
17 is  FVIRTKEY & FALT

FVIRTKEY (TRUE, 0x1)The accelerator key is a virtual-key code. If this flag is not specified, the accelerator key is assumed to specify an ASCII character code.

You should use bit-wise  operations with fVirt variable.  
Back to Top
wrecks View Drop Down
Groupie
Groupie


Joined: 14 July 2015
Status: Offline
Points: 42
Post Options Post Options   Thanks (1) Thanks(1)   Quote wrecks Quote  Post ReplyReply Direct Link To This Post Posted: 03 April 2017 at 5:10pm
Thank you, Oleksandr.  For your next release, maybe you could add that information to the help file.  Right now it only shows: 

Public Const FSHIFT = 4
Public Const FCONTROL = 8
Public Const FALT = 16


Can you comment on the short integer ID codes?  Is that a bug?
Back to Top
olebed View Drop Down
Admin Group
Admin Group


Joined: 01 July 2014
Location: Ukraine
Status: Offline
Points: 841
Post Options Post Options   Thanks (0) Thanks(0)   Quote olebed Quote  Post ReplyReply Direct Link To This Post Posted: 05 April 2017 at 1:31pm
Hello,

There is a real bug with getting only last 2 bytes from control ID. And only in CXTPCustomizeKeyboardPage::OnAssign() method. In other places  used whole ID.

I've fixed this. Thank you for bringing this to our attention.

Hot fix for MFC version:
void CXTPCustomizeKeyboardPage::OnAssign()
{
.....
    pAccel->cmd = pControl->GetID();    //pAccel->cmd = (WORD)pControl->GetID();
.....
}

Regards,
 Oleksandr Lebed
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.125 seconds.