TAction.SecondaryShortCuts is language dependent. How to install it correctly?

I just used the SecondaryShortCuts function for Delphi TAction. But shortcuts are defined by strings such as "F5" or "Shift + F5." Now the problem: on my German Windows, the action does not work, because the "Shift" key is called "Umsch" in German! Does this mean that SecondaryShortCuts-Property is completely useless during development because no one can create applications that work internationally with this?

I can set the key at runtime by translating VK_SHIFT into the correct name. I tried it through GetKeyNameText , but this did not work because it gave a long form of "Umschalt" not "Umsch". Does anyone know a function to get a short version of a key name?

+4
source share
1 answer

You can try: Create shortcut text from shortcut:

var s: TShortCut; begin s := ShortCut(Ord('A'), [ssShift]); Action1.SecondaryShortCuts.Add(ShortCutToText(s)); 

By the way, these values ​​are determined by the following constants. Did you translate them? And if so, what do you need ?:

 SmkcShift = 'Shift+'; SmkcCtrl = 'Ctrl+'; SmkcAlt = 'Alt+'; 
+5
source

Source: https://habr.com/ru/post/1442967/


All Articles