tab key focus shift instead of insert '\t'

SyntaxEditor for WPF Forum

Posted 9 years ago by Brian Bennewitz
Version: 10.2.0533
Avatar
Is there a way to set up the SyntaxEditor to 'shift focus' to the next element in the FocusScope when TAB ('\t') is typed, rather than inserting the tab ('\t') into the editor? I couldn't seem to find this topic in the help file and am not clear if it needs to be incorporated into the lex/parse details for the language in the editor or if it is exposed somewhere by the editor itself.

Thanks,
~Brian Bennewitz
bbennewitz@inrule.com

Comments (2)

Posted 9 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hello,

There are a number of KeyBinding objects that are added by default into the SyntaxEditor's InputBindings collection. You would need to remove the KeyBinding for the Tab key to achieve the behavior you desire.

This can be done by iterating through the items in the InputBindings collection of the SyntaxEditor instance and removing the item if it is a KeyBinding with the Key property set to Tab and the Modifiers property set to None.

Here is some sample code that could perform this task:
for (int a = 0; a < editor.InputBindings.Count; a++) {
    var binding = editor.InputBindings[a] as KeyBinding;
    if (binding != null) {
        if ((binding.Key == Key.Tab) && (binding.Modifiers == ModifierKeys.None))
            editor.InputBindings.RemoveAt(a);
    }
}
Please let us know if you have further questions.


Actipro Software Support

Posted 9 years ago by Brian Bennewitz
Avatar
Perfect thanks!
The latest build of this product (v2019.1 build 0683) was released 1 month ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.