How to verify the cursor range of quick information?

SyntaxEditor for WPF Forum

The latest build of this product (v2020.1.1) was released 2 months ago, which was before this thread was created.
Posted 11 days ago by Sunshine - Appeon
Version: 20.1.0
Avatar

When I point the mouse to the word on the editor, the quick info window will pop up normally.

But as long as my mouse coordinates change, the window will disappear immediately.

The effect I need is: when the mouse is within the current word range or on the quick information window, it will not disappear. By looking at the official case, I cannot find how to control the closing of the window. Do you have any suggestions? Thanks in advance!

Comments (8)

Posted 11 days ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hello,

It sounds like you might not be passing the ideal textRange argument when opening the quick info session.  The API I'm mentioning is:

session.Open(view, textRange);

If you pass in the text range of your word (or whatever the target text is), then the quick info should stay active while the mouse is over that text range.


Actipro Software Support

Posted 11 days ago by Sunshine - Appeon
Avatar

Thank you for your reply!

I confirm that I have passed the range parameter.This is the code I am calling in RequestSession.

I use the mouse to point to the first word 'using' in the editing area.

The value of 'context.Range' is 0 to 5 ,But the result is still the same.

In addition, I also found that if you do not assign a value to ‘session.Context’.

After the quick information window pops up, move the mouse outside the area and the window will not disappear. The window will not close until the left mouse button clicks on another area or the event is triggered again.

Are there other possible causes of this result?

protected override bool RequestSession(IEditorView view,object context)
{
    var session=new QuickInfoSession;

    session.Content=new MyView();

    session.Context=context;

    session.Open(view,context.Range);
}
Answer - Posted 10 days ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hello,

The other thing is that you want to make sure you do use a context object and that the context's Equals method is implemented.  This is done so that as other context examinations are being made, they can be compared to the one that showed the quick info.  If they are the same, then nothing is redisplayed.

Please see the "IntelliPromptQuickInfo" QuickStart in the Sample Browser's SyntaxEditor samples.  That has a nice implementation of quick info that behaves how you want and is a good starting point example.


Actipro Software Support

Posted 5 days ago by Sunshine - Appeon
Avatar

Thanks for your answer!

After overriding the Equals method of the context, the mouse will disappear only when the mouse moves out of the specified area window.

However, if you want the window not to disappear when the mouse moves in the quick information window area, can you achieve this goal by overriding some methods on the premise of inheriting QuickInfoProviderBase? Or do I need to inherit IQuickInfoProvider to independently implement its regional verification logic?

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

Hello,

If you have the context set up properly like in the IntelliPrompt Quick Info QuickStart, the quick info tip shouldn't close if you are keeping the mouse anywhere over the target word's text range.

If you instead mean when the mouse moves over the actual quick info tip itself, I don't believe we support the mouse moving over the quick info tip at this time.  It will always close for that scenario, since the tips aren't currently intended to be clickable.


Actipro Software Support

Posted 3 days ago by Sunshine - Appeon
Avatar

Thanks for your reply, my question has been resolved!

Posted 3 days ago by Sunshine - Appeon
Avatar

Sorry to ask again.

If I want to use the mouse to manipulate the content in the quick information window (for example, copy text or click), what is the best practice solution?

Posted 2 days ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hello,

Let me clarify the previous answer.  If you use a mouse hover to trigger the quick info to show, we then track the mouse movement and if it moves outside of the target text range used as context, it will close.  Thus you can't really move over the quick info tip in this scenario since the mouse movement is being watched.

That being said, if you programmatically open the quick info tip via something like in some of our samples' toolbar buttons, it will not watch the mouse and you could be able to click content in the quick info tip. For instance, executing this code will show the quick info for the caret location but will not close the quick info tip in response to the mouse location moving:

editor.ActiveView.IntelliPrompt.RequestQuickInfoSession()


Actipro Software Support

Add Comment

Please log in to a validated account to post comments.