Customize result based on key pressed in completion list

SyntaxEditor for WPF Forum

Posted 15 years ago by Gustavo Guerra
Version: 9.1.0503

Some of my completion items have "Action(" as pre text and ",,)" as post text, so that when I press enter on the completion list the caret gets positioned on the first argument. I would like to not do this when the session is commited by the dot or space key, in that case, I'd like it all to be pre text. Is there any way to do this? I could add some info on the Tag to know how many characters the post text has and in the Committed event change the caret position accordingly, but how can I now which key triggered the completion?

Best Regards,
Gustavo Guerra

Comments (2)

Posted 15 years ago by Actipro Software Support - Cleveland, OH, USA

We don't pass that information along right now. However what you could do is create a class that inherits CompletionSession and override:
protected override void OnViewTextInput(IEditorView view, TextCompositionEventArgs e) { ... }
In our implementation of that method, we check to see if each character in e.Text is either a letter/digit or is in the AllowedCharacters collection. If not, a Commit or Cancel occurs.

You could track the last e.Text that was passed and then in your event handler look at that value to determine what to do.

Actipro Software Support

Posted 15 years ago by Gustavo Guerra
Thanks, that will work.
The latest build of this product (v24.1.2) was released 3 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.