I want to hide intellisense popup when there is no items matched

SyntaxEditor for WPF Forum

Posted 4 years ago by BERKANT ORAL
Version: 15.1.0621
Platform: .NET 4.5
Environment: Windows 8 (64-bit)
Avatar

Hi there,

I want to hide (no items) hint box when there is no matched items found. Because with our application, user enters some text and press enter key to accept the text. However if intellisense session filter does not match any items, first enter key stroke closes intellisense (no items) hint box and another enter key stroke is needed to accept user input.

Can you please suggest a way to overcome this situation.

Actually, I want to use intellisense feature only if it can help user to easily write predefined strings and if not silently hides itself and allow underlying textbox to catch key events like a simple textbox control.

Thanks.

Comments (5)

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

Hello,

The CompletionSession.IsEnterKeyHandledOnCommit property can be used to determine if the Enter key down gets handled when a selection is made and committed (via Enter).  If there is no selection and Enter is pressed, there is nothing to commit, which is why Enter is not handled in that case.

Which language are you using this with, one of ours or a custom one you have written?  If it's one of yours, in your completion provider's RequestSession method, you could check to see if all items are filtered before opening the session and if so, skip opening it.


Actipro Software Support

Posted 4 years ago by BERKANT ORAL
Avatar

I am simply creating and opening a CompletionSession on DocumentTextChanged event. I am not using any kind of provider. Can you please tell me how I can get filtered results before openning a completion session and decide to open it or not?

Also my question includes is it possible to hide (no items) hint box when there is no matched items.

Thanks.

Simplified code describing my problem:

_editor.DocumentTextChanged += (s, e) =>
{
	var session = new CompletionSession();
	foreach (var info in args.SessionItems)
	{
	   //fill some session items
	} 
	session.Open(_editor.ActiveView);
};
Posted 4 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hello,

Can you describe more about which filters or filter options you are using?  I don't see any in the code snippet above.  Or do you simply mean that if the end user presses Enter while nothing in the list is fully selected, you want the list to cancel instead of committing?

There isn't currently an option to hide the completion list when no filters apply.  It will currently show a no items message instead.  I will add that suggestion to our list.


Actipro Software Support

Posted 4 years ago by BERKANT ORAL
Avatar

The filter I mention for is simple item matching via user input. I am not talking about filter with icons functionality. So I simply mean if the end user presses Enter while nothing in the list is fully selected, I want the list to cancel and allow Enter Key Event to pass through underlying editor.

Also it would be nice to hide completion list when no filters apply. However my main problem is enter key event must pass through if there is no possible commit.

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

Hello,

The quickest way to prevent display on no full match would be to handle the session's Opened event and in that, look at its Selection.  If the Selection has a State of Partial, then call Cancel() on the session.  It might have the popup very quickly flicker visible and then hide it.  If you want to get more low-level, before you ever open the session, you could loop through each of the ItemMatchers on the session and call each Match() method to see if you get a Full selection.  If any return a Full selection then you know you should open the session.

As far as the Enter key, looking at our code, I don't believe we "handle" (mark e.Handled = true) for Enter when the selection is partial, so it should be flowing through to the editor in that case.  We do mark it handled if there is a full selection and IsEnterKeyHandledOnCommit is true.


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.