Shortcut Keys in containing form's menu

Topics: Developer Forum, User Forum
May 29, 2007 at 7:56 PM
Hey,

I'm using the latest files from repository in my application. The control is on a form that uses menus, and the menus have a shortcut key assigned. But when I press the shortcut, the editor displays an oval with text in it.

For example, I have a Save item under File. The shortcut key assigned is Ctrl-S. But when you press Ctrl-S while the Scintilla control is active, it just inserts the oval with DC3 in it. Ctrl-F (assigned to the Find menu item) has an oval with ACK.

If I look in the Designer.cs file, it shows this for that menu item:
this.mnuFile_Save.ShortcutKeys = ((System.Windows.Forms.Keys) ((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.S)));

I know SCide handles these correctly. Is there anything anybody recommends to do or check?

Thanks,
Matt
Jun 1, 2007 at 1:48 PM
Apparently revision 19215 added an ignore keys list to the ScintillaControl. The control now preprocesses the key shortcut commands to check whether to pass them to the underlying Scintilla control. So you have to add them to the list of ignored keys by one of the following:
public virtual void AddShortcuts(Form parentForm);
public virtual void AddShortcuts(ToolStripItemCollection m);
public virtual void AddIgnoredKey(System.Windows.Forms.Keys shortcutkey);

And they can be cleared by:
public virtual void ClearIgnoredKeys();
Coordinator
Jul 11, 2007 at 6:27 AM

cuppm wrote:
Apparently revision 19215 added an ignore keys list to the ScintillaControl. The control now preprocesses the key shortcut commands to check whether to pass them to the underlying Scintilla control. So you have to add them to the list of ignored keys by one of the following:
public virtual void AddShortcuts(Form parentForm);
public virtual void AddShortcuts(ToolStripItemCollection m);
public virtual void AddIgnoredKey(System.Windows.Forms.Keys shortcutkey);

And they can be cleared by:
public virtual void ClearIgnoredKeys();


Yeah, Scintilla has a nasty habit of consuming EVERY keystroke, including accelerator keys
Aug 7, 2007 at 11:42 AM
Edited Aug 7, 2007 at 11:44 AM
Hi there,

I just moved to the current revision (25322) and there aren't anymore one of those methods to set "ignored key". I also searched in the souce for "shortcut", "ignore", and "key" but found nothing.

So, what happend? Or is there still someone working on it?

Kind regards,
gregor w.
Coordinator
Aug 7, 2007 at 5:27 PM
In the latest version I didn't include it because it's really unnecessary. If you have the "SupressControlCharacters" property set to true (true is the default) accelerator keys and Control+XX combinations are not handled by Scintilla and are instead allowed to be handled by the application.

Additionally if you want other keystrokes not to be handled by scintilla you can handle the KeyDown and KeyPress events just like a standard TextBox setting e.Handled or e.SupressKeyPress to true.
Aug 7, 2007 at 6:43 PM
Edited Aug 7, 2007 at 6:44 PM
Ah ok. So I do it this way. I was only a bit confused why they aren't there anymore...

But I think it's ok this way (or even better) :-).

Thank you (and you do a great work!),
Gregor W.