Performance of IntelliPrompt.InfoTip.Show(...)

SyntaxEditor for Windows Forms Forum

Posted 18 years ago by Dong JIA
Avatar
When user change the cursor, I want to bold the current parameter in InfoTip.
So I construct the informations in OnSelectionChanged. In order to reflect the information into infoTips, I call IntelliPrompt.InfoTip.Show().
The problem is:
The performance of show seems low.
if user pressing leftarrow, user can not see the cursor until keyup.

Could somebody give me some advices to avoid it?

Comments (7)

Posted 18 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
In v4.0 we have code to automate the determination of what parameter is selected and have a new method ParameterChanged which tells you when the caret moves to a different parameter.

But in v3.1 what you essentially would do is in OnSelectionChanged, determine the parameter index that the caret is in. If it is different than before, update the data in IntelliPrompt.InfoTip.Info[IntelliPrompt.InfoTip.SelectedIndex] only. Then call IntelliPrompt.InfoTip.MeasureAndResize. I believe all those items are available to you in v3.1 and is what we essentially do in our implementation v4.0. That way you are only updating one item and it works fast.


Actipro Software Support

Posted 18 years ago by Dong JIA
Avatar
thanks for your response.
I repace Show with MeasureAndResize, and it works well.
Posted 18 years ago by Karl Grambow
Avatar
Hi,

I had this same problem and I've now switched to using MeasureAndResize.

However, whenever I perform a MeasureAndResize, the border of the InfoTip is always the same size it was originally so if the InfoTip is bigger than the previous one, the border is cutoff.

I noticed in the documentation that it indicates DesktopBounds should be used to get the new size after using MeasureAndResize but it doesn't say what I should do with the desktop bounds value.

Am I doing something wrong here?

Karl
Posted 18 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Karl,

Hmm... in the parameter info tips we use in the C# add-on, I'm not seeing the border issue occur. Could you send over code that can be added to the sample project to duplicate it? It should work appropriately based on what you are doing.


Actipro Software Support

Posted 18 years ago by Karl Grambow
Avatar
Hi,

Here's some code you can try. To illustrate the problem. Note that I'm not using any of the addons. This is just a standard editor.

To get it working, just type an opening bracket, "(" to activate the infotip. Then press any key to fire the code in the selectionchanged event.

Thanks,

Karl

Private Sub SyntaxEditor1_KeyTyped(ByVal sender As Object, ByVal e As ActiproSoftware.SyntaxEditor.KeyTypedEventArgs) Handles SyntaxEditor1.KeyTyped

        If e.KeyChar = "(" Then
            SyntaxEditor1.IntelliPrompt.ParameterInfo.Info.Clear()
            SyntaxEditor1.IntelliPrompt.ParameterInfo.Info.Add("Here is a test infotip.  Now press any key.")
            SyntaxEditor1.IntelliPrompt.ParameterInfo.Show(SyntaxEditor1.SelectedView.Selection.EndOffset)
        End If

    End Sub

    Private Sub SyntaxEditor1_SelectionChanged(ByVal sender As Object, ByVal e As ActiproSoftware.SyntaxEditor.SelectionEventArgs) Handles SyntaxEditor1.SelectionChanged

        If SyntaxEditor1.IntelliPrompt.ParameterInfo.Visible Then
            SyntaxEditor1.IntelliPrompt.ParameterInfo.Info.Clear()
            SyntaxEditor1.IntelliPrompt.ParameterInfo.Info.Insert(0, "This is a longer infotip to show how the border doesn't resize.")
            SyntaxEditor1.IntelliPrompt.ParameterInfo.MeasureAndResize(SyntaxEditor1.IntelliPrompt.ParameterInfo.DesktopBounds.Location)
        End If

    End Sub
Posted 18 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Thanks, we added a repaint call at the end of MeasureAndResize to fix this.


Actipro Software Support

Posted 18 years ago by Karl Grambow
Avatar
Great.

By the way the same problem occurs in v4.0 - I'm sure you already knew that though.

Karl
The latest build of this product (v24.1.0) was released 2 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.