So something like CTRL+K with toggle a bookmark in the editor. How do I override this to do something else?
We're trying to implement SQL commenting using CTRL+K and then CTRL+C (like SQL Server Management Studio) and while we can register CTRL+K when we click on CTRL+C nothing happened. If click CTRL+K again it toggles a bookmark.
I asked a similar question years ago on the older boards, but was never able to implement it. :P Trying again if you have this information. Thank you.
Please use the following code snippet to override the default key handler:
var keyList = syntaxEdit1.KeyList;
int bookmarkState = 1;
keyList.Add(Keys.C | Keys.Control, new KeyEvent(CommentSelectionHandler), bookmarkState, 0);
As an alternative, it is also possible to derive from Selection class, and override CommentSelection() method there. The custom Selection class needs to be then used in SyntaxEdit.CreateSelection() factory method.
Thank you for the reply Yevgeni! We'll give this a look!