Reputation: 31
I have mfc application where I defined keyboard ACCELERATORS It works fine when I use alphanumeric characters, but I want to define an accelerators that zoomin/zoomout while pressing on the keys +/- so I defined it as the following and it works fine
ID1 ACCELERATORS DISCARDABLE
{
"+", ID_ZOOMIN , ,ASCII, NOINVERT
"-", ID_ZOOMIN ,ASCII, NOINVERT
}
Now I added a text box that can accept "+/-" as charcters but pressing on them now function as zoomin/zoomout and the characters "+/-" are not typed so I changed my implementation to have the "zoomin/zoomout" functionality only works while the control button is pressed
ID1 ACCELERATORS DISCARDABLE
{
"+", ID_ZOOMIN , ,ASCII, CONTROL, NOINVERT
"-", ID_ZOOMIN ,ASCII, CONTROL, NOINVERT
}
but still pressing +/- or Ctrl + +/Ctrl + -" function as "zoomin/zoomout" and the +/- characters are not typed Note: changing ASCII to VIRTKEY doesn't solve the problem
Any ideas??
Upvotes: 2
Views: 1642
Reputation: 4272
I've just tested with my Windows laptop. It seems ASCII accelerators don't support the CONTROL
modifier.
Use VIRTKEY
instead.
ID1 ACCELERATORS DISCARDABLE
{
107, ID_ZOOMIN, VIRTKEY, CONTROL, NOINVERT
109, ID_ZOOMOUT, VIRTKEY, CONTROL, NOINVERT
}
Or specify VK_ADD
for +, VK_SUBTRACT
for -.
Upvotes: 1