Tooltips not showing on Toolbar buttons w/o focus

G

Greg Burns

I added a toolbar to a form and added one button. I made sure ShowToolTips
= true for the Toolbar, and have set a tooltip for the button.

The problem is the tooltip only shows after clicking somewhere on the
toolbar itself. It seems it needs to have the focus before tooltips will
show.

Any ideas?

Greg



Public Class Form1
Inherits System.Windows.Forms.Form

#Region " Windows Form Designer generated code "

Public Sub New()
MyBase.New()

'This call is required by the Windows Form Designer.
InitializeComponent()

'Add any initialization after the InitializeComponent() call

End Sub

'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub

'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer

'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
Friend WithEvents ToolBar1 As System.Windows.Forms.ToolBar
Friend WithEvents ToolBarButton1 As System.Windows.Forms.ToolBarButton
<System.Diagnostics.DebuggerStepThrough()> Private Sub
InitializeComponent()
Me.ToolBar1 = New System.Windows.Forms.ToolBar
Me.ToolBarButton1 = New System.Windows.Forms.ToolBarButton
Me.SuspendLayout()
'
'ToolBar1
'
Me.ToolBar1.Buttons.AddRange(New
System.Windows.Forms.ToolBarButton() {Me.ToolBarButton1})
Me.ToolBar1.DropDownArrows = True
Me.ToolBar1.Location = New System.Drawing.Point(0, 0)
Me.ToolBar1.Name = "ToolBar1"
Me.ToolBar1.ShowToolTips = True
Me.ToolBar1.Size = New System.Drawing.Size(292, 42)
Me.ToolBar1.TabIndex = 0
'
'ToolBarButton1
'
Me.ToolBarButton1.Text = "Test"
Me.ToolBarButton1.ToolTipText = "Test"
'
'Form1
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(292, 266)
Me.Controls.Add(Me.ToolBar1)
Me.Name = "Form1"
Me.Text = "Form1"
Me.ResumeLayout(False)

End Sub

#End Region

End Class
 
H

Herfried K. Wagner [MVP]

Hello,

Greg Burns said:
I added a toolbar to a form and added one button. I made sure
ShowToolTips = true for the Toolbar, and have set a tooltip for the button.

The problem is the tooltip only shows after clicking somewhere on the
toolbar itself. It seems it needs to have the focus before tooltips will
show.

I was not able to reproduce that using your code on a Windows XP
Professional machine running .NET 1.0.

HTH,
Herfried K. Wagner
 
G

Greg Burns

Nevermind.

Tried this in VS.NET 2002 and it worked fine. Went back to 2003 and now it
is working also(!) Very strange. I first noticed this with a compiled
program running outside of VS.NET. Even that has begun working again. Must
have been the OS playing games with me. :)
 
E

Ender

I have been having the exact same problem. If anyone has a solution,
that would be great!
 

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