EControl Ltd. Forum Index EControl Ltd.
VCL libraries and software support forum
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

TSyntKeyMappings -- Guide?

 
Post new topic   Reply to topic    EControl Ltd. Forum Index -> EControl Syntax Editor
View previous topic :: View next topic  
Author Message
ulrikj



Joined: 07 Aug 2006
Posts: 12

PostPosted: Thu Sep 14, 2006 8:06 am    Post subject: TSyntKeyMappings -- Guide? Reply with quote

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
View user's profile Send private message
ulrikj



Joined: 07 Aug 2006
Posts: 12

PostPosted: Thu Sep 14, 2006 9:28 am    Post subject: My current solution Reply with quote

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! Smile

What's the logic behind it?
Back to top
View user's profile Send private message
econtrol
Site Admin


Joined: 09 Jun 2006
Posts: 202

PostPosted: Thu Sep 14, 2006 1:34 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    EControl Ltd. Forum Index -> EControl Syntax Editor All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group