VS like hot-key behavior

SyntaxEditor for Windows Forms Forum

Posted 8 years ago by Tobias Lingemann - Software Devolpment Engineer, Vector Informatik GmbH
Version: 4.0.0288
Avatar
Hi,

I would like to implement a hot-key behavior similar to VS.
For example the comment line command is triggered with a "Ctrl+K" key followed by a "Ctrl+C" key. My understanding is, that I cannot react on "Ctrl+C" because it is already used for the copy command.
I tried to disable the command links of my syntax editor, but it did not help.

Do you have any suggestions, how to realize this?


[Modified at 05/31/2011 07:37 AM]


Best regards, Tobias Lingemann.

Comments (2)

Posted 8 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Tobias,

If you clear the SyntaxEditor.CommandLinks collection, then that should wipe out any key bindings that SyntaxEditor has. That is where they are all set up, including the clipboard ones.

"Chord" hotkeys like that would have to be handled external to SyntaxEditor once you clear the CommandLinks collection.


Actipro Software Support

Posted 8 years ago by Tobias Lingemann - Software Devolpment Engineer, Vector Informatik GmbH
Avatar
Thanks for your answer.
Actually the problem was a different one. My form had defined shortcuts for copy/paste in the menubar. That is why my editor never got the event.
I removed the shortcuts of the form and in my code I just do this:

  if (e.KeyData == (Keys.Control | Keys.K))
  {
    // enable shortcut mode (Ctrl+K)
    this.shortcutModeEnabled = true;
    e.Cancel = true;
  }
  else if (e.KeyData == (Keys.Control | Keys.C))
  {
    if (this.shortcutModeEnabled)
    {
      // comment lines
      syntaxEditor.RaiseCommand(new CommentLinesCommand());
      this.shortcutModeEnabled = false;
      e.Cancel = true;
    }
  }
The cancellation of the event is important to avoid that the (still active) command link is executed.

[Modified at 06/01/2011 05:12 AM]

[Modified at 06/01/2011 05:19 AM]


Best regards, Tobias Lingemann.

The latest build of this product (v2018.1 build 0341) was released 7 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.