How to implement feature like Visual Studio debugger tooltips?

SyntaxEditor for Silverlight Forum

Posted 11 years ago by Samuel Jack - Managing Director, Seaturtle Sofware Ltd
Version: 12.2.0143
Avatar

Hi,

    I'd like to implement a feature like Visual Studio's debugger tooltips in Silverlight SyntaxEditor. What I want is that hovering over a certain kind of tagged text (actually an item id) should show a tooltip containing a + icon which I can click. Clicking that + icon would then show a further popup containing details of the item.

We currently have a QuickInfoProvider working, so that hovering over the text shows a popup. The problem is that whenever you move the mouse towards the popup itself, it dissapears, so using a QuickInfoSession, there would be no way for the user to click a button inside it.

I'm guessing I'd need to implement another kind of Intelliprompt session? I did see IntelliPromptSessionTypes.SmartTag which sounds like it could be what I need, but there doesn't seem to be anything making use of SmartTags anywhere else in the code.

What is your recommended approach here. Any chance of any code samples to get me going?

Thanks!

Comments (8)

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

Hi Samuel,

That is correct, the quick info mechanism (when opened via the mouse at least) is intended to hide itself as soon as you move outside of the target range.

That being said if you open quick info programmatically (such as for when you click the quick info toolbar button), it will ignore mouse movement.  That sort of call can be made by calling the QuickInfoProvider like this:

provider.RequestSession(view, context, false);

The false argument tells it not to track the mouse.  The problem is that all our built in mouse watching code to detect when to show quick info will pass true to that RequestSession method.  Are you able to externally watch mouse movement and call the method I mentioned above, to see if that gets you the desired behavior?


Actipro Software Support

Posted 11 years ago by Samuel Jack - Managing Director, Seaturtle Sofware Ltd
Avatar

Thanks for the suggestion. That gets me most of the way there. The trouble is now that the tooltip is closing prematurely when I interact with content inside it - it has scroll bars for instance, and when I release the mouse after dragging a scrollbar my tooltip will close.

Anyway to prevent that happening?

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

Hi Samuel,

Hmm... what if you set e.Handled = true from your scrollbar event?  I wonder if that would prevent our code from getting it then?


Actipro Software Support

Posted 11 years ago by Samuel Jack - Managing Director, Seaturtle Sofware Ltd
Avatar

I would have thought that the scrollbars (which are actually part of an Actipro SyntaxEditor which we're hosting in the toolip) would already be marking the event as handled.

My guess was that there is some other code somewhere which is monitoring mouse events and making the tooltips close?

We're currently using a QuickInfoProvider - would it help to create a provider of our own with its own type of session. If so, do you have a sample for this?

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

Oh, I see... you meant SyntaxEditor's scrollbars.  Sorry I thought you meant some that you perhaps put in your popup.

Could you put together a new simple sample project that shows the issue and we'll see if we can determine where it's closing from and if there's any wokrarounds?  Please reference this post and rename the .zip file extension so it doesn't get spam blocked.

At a quick glance the only thing I see is that the QuickInfoSession.OnViewSelectionChange code will close the session if the caret moves outside of the target text range. I wouldn't think scrolling would do that though.  So this could be more of a focus move event causing the close.


Actipro Software Support

Posted 11 years ago by Samuel Jack - Managing Director, Seaturtle Sofware Ltd
Avatar

I did actually mean that interacting with content in the popup is causing the problem. The SyntaxEditor that's causing the problem is hosted inside the tooltip.

The interaction goes like this:

  1. User hovers over some text in the main SyntaxEditor
  2. Our code requests a QuickInfoSession. QuickInfoSession is set to display a UIElement that contains a button
  3. User clicks the button, and the QuickInfo tooltip now expands to show another SyntaxEditor
  4. User scrolls around in this new SyntaxEditor, but when they let go of the scroll bar after dragging, the whole QuickInfo tooltip closes.
Posted 11 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Oh, you're tricky! :)  I'm not sure offhand, we'd probably need to debug it.  You might be able to determine it yourself if you put a breakpoint in the session's Closed event handler and see the stack trace.  After the session opens, it will be in the editor.IntelliPrompt.Sessions collection.


Actipro Software Support

Posted 11 years ago by Samuel Jack - Managing Director, Seaturtle Sofware Ltd
Avatar

That was a good suggestion. It turned out my session was being closed because my mouse-hover handling code was kicking in and requesting another session be opened.

I think I'm pretty much there now. Thanks!

The latest build of this product (v18.1 build 0233) was released 4 years ago, which was after the last post in this thread.