CompletionSession, Committing and dialogs

SyntaxEditor for WPF Forum

Posted 7 years ago by Kasper
Version: 12.2.0570
Platform: .NET 4.0
Environment: Windows 7 (64-bit)
Avatar

Hi guys,

It seems that if you show a custom dialog from the Committing event of a CompletionSession, the result never makes it back to the editor. I'm not sure what happens, but it's very easy to re-produce, e.g. in your IntelliPromptCompletionCustomActions sample. Simply comment out the line that cancels the session and then make sure that the AutoCompletePreText text has a value. If the MessageBox is displayed, nothing is inserted back into the editor. If the MessageBox line is commented out, it works as expected and the AutoCompletePreText is inserted.

Comments (3)

Answer - Posted 7 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Kasper,

The problem here is that when you show the MessageBox, it's taking focus away from the completion list and by default, focus loss will close the list.  Thus your session closes when the MessageBox is opened.  You might be able to override the ClosesOnLostFocus property to have it return false if you inherit CompletionSession in a custom class.


Actipro Software Support

Posted 7 years ago by Kasper
Avatar

I was under the impression that your demo was trying to show exactly the same thing that I want: The ability to select the inserted value from a custom dialog instead of directly from the list - is that not the case? If it is, then I do find it a bit odd that I have to do a custom CompletionSession implementation that, as you put it, might work, to accomplish it?

Besides, that seems like a complicated solution, compared to just manually inserting the text which is what I ended up doing for now :)

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

Well really here the completion session is already closing due to the commit of the dialog opening item.  So it does make more sense anyhow for you to manually insert the text as you already are in that scenario.  Even if you did happen to inject a modal dialog right there as I said with the ClosesOnLostFocus change (which can be done in a few lines of code), you'd have to update the selected completion item's pre- and post-text results prior to exiting of the OnSessionCommitting event.  Your text replacement is more straightforward.


Actipro Software Support

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.