View previous topic :: View next topic |
Author |
Message |
ulrikj
Joined: 07 Aug 2006 Posts: 12
|
Posted: Thu Sep 14, 2006 8:06 am Post subject: TSyntKeyMappings -- Guide? |
|
|
Hi,
How does one programmatically use the TSyntKeyMapping class? I.e., how do I figure out what the Cardinal value I should use for a given key is, when I want to assign it to a command?
The documentation seems to indicate the Key[0] and Key[1] of TecOverKey are Cardinals, yet it presents their values as string-representations of the keys ("CTRL + O ..")..
Best regards, |
|
Back to top |
|
|
ulrikj
Joined: 07 Aug 2006 Posts: 12
|
Posted: Thu Sep 14, 2006 9:28 am Post subject: My current solution |
|
|
My current solution is this:
Code: |
{ Remove the bindings for Clear Selection on Ctrl-Del. (and the empty one)}
KeyMappings.SetEmpty(smClearSelection, 0);
KeyMappings.SetEmpty(smClearSelection, 1);
{ Add a new keybinding for the smCut command, being Shift-Del. }
KeyMappings.SetKey(smCut, 8238, 1);
|
The problem with this is that in order to deduce that 8238 value I had to create a new SyntMemo+KeyMapper project, customize it as I wanted, view the form as Text and find the value in the KeyInfo parameter for the syntKeyMapping. This can't be the best way of figuring out the cardinal value of a key!
What's the logic behind it? |
|
Back to top |
|
|
econtrol Site Admin
Joined: 09 Jun 2006 Posts: 202
|
Posted: Thu Sep 14, 2006 1:34 pm Post subject: |
|
|
There is a component editor for TSyntKeyMapping, so there is no need to change keystrokes programmatically.
In code it may be done as:
Code: | KeyMappings.SetKey(smCut, scShift + VK_DELETE, 1); |
|
|
Back to top |
|
|
|