Is there a Workaround for the Tooltip Bug?

C

Charles Law

Although I can find few reports of the problem, it seems plain that tooltips
just don't work (in VB.NET at any rate).

I have an MDI child form with a TrackBar control on it. I have a private
Tooltip variable (m_Tooltip) which I use as follows:

Sub Form_Load(...)

m_ToolTip = New ToolTip

m_ToolTip.SetToolTip(TrackBar1, "Drag to change position, or use cursor
keys for fine adjustment")

End Sub

The form loads and I hover over the trackbar. The tooltip is displayed. I
drag the trackbar a bit, and the tooltip is never shown again, no matter
what I do.

Is there a way to get round this and make tooltips work properly?

TIA

Charles
 
C

Charles Law

Hi Ulrich

Thanks for the link, but your notes on tooltips really only repeat what I am
doing already. The problem still exists.

Although I have described the problem on an MDI child form, my primary
application scenario has user controls with tooltips, placed on other user
controls, that are placed on MDI child forms. In this case, the tooltip
shows until the base user control is clicked, and then it vanishes. Even
when the control loses focus, the tooltip does not return.[I feel that a
..NET service pack is long overdue]

Charles
 
C

Charles Law

I am surprised at the lack of response to this post, as it will affect
anyone who tries to use a tooltip on a user control.

But, if anyone is interested, I have a workaround: in the MouseEnter event
of the control that has the tooltip, place the following code

<code>
Tooltip1.RemoveAll()
Tooltip1.SetTooltip(MyControl, "MyControl tooltip text here")
</code>

If there are other suggestions I would be interested to hear them.

Charles
 
C

Cor Ligthert

Hi Charles
I thought there will be so much who answer this, that I would be to late.

It is of course again quick done, you can measure it at the point as well
in my opinion.

I hope this helps,

Cor
\\\
Private ToolTip1 As New ToolTip
Private Sub TrackBar1_MouseMove(ByVal sender _
As Object, ByVal e As System.Windows.Forms.MouseEventArgs) _
Handles TrackBar1.MouseMove
Static LastCursor As Point
Dim NowCursor As Point = New Point(Cursor.Position.X,
Cursor.Position.Y)
If Point.op_Inequality(NowCursor, LastCursor) Then
Me.ToolTip1.SetToolTip(DirectCast(sender, TrackBar), _
"Hi Charles make it yourself again nice")
End If
LastCursor = Cursor.Position
End Sub
////
 
C

Charles Law

Hi Cor

Yes, I also wondered about using the MouseMove event, but decided to try the
MouseEnter event as it fires less often. Both seem to work well though.

Regards

Charles
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top