It might be natural to use Ctrl+ +, Ctrl+, -and Ctrl+ 0as shortcuts to scale the application, zoom out, and restore the default scale (usually 100%). Now, in Delphi, I can assign Ctrl+ +and Ctrl+ 0as shortcuts. The first, however, requires that the plus sign of the main part of the keyboard be used; The plus sign of the numeric keypad cannot be used.
The problem arises, however, when I want to designate Ctrl+ -as a shortcut. It just doesn't work. If I assign "Ctrl + -" in the IDE, the value stored in the property ShortCutis equal 16495. If we subtract from this ssCtrl, we get 111. The bypass, as one might assume, would consist in the appointment ShortCut := 45 + ssCtrlor, equivalently ShortCut := Menus.ShortCut(45, [ssCtrl]), because ord('-') = 45. But that does not work.
However, I found a working solution: ShortCut := 189 + ssCtrl. I choose 189 because it is the number that I get when I press the "-" key and listen to the event KeyDown.
So why am I not happy with this? Well, I'm afraid that the constant 189 is only valid on Swedish keyboards. I tried to read about it, and, as usual, the MSDN documentation is pretty clear, but then who knows how Delphi handles things.
source
share