dcsimg
Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.


Tip of the Day
Language: Visual Basic
Expertise: Intermediate
Jul 24, 1998

WEBINAR:

On-Demand

Building the Right Environment to Support AI, Machine Learning and Deep Learning


Display Tooltips

You can easily duplicate the tooltips that appear when you float the mouse over a button in Microsoft's products. This code displays the tooltip in the lower right-hand corner of the control (normally a button):

 ' xTip: string to display as the tip
' xCtrl: control you want the tip to show for.
' xTipControl: control being used to display 
' the tip (an SSPanel)
Public Sub ShowTip(xTip As String, xCtrl As _
	Control, xTipControl As Control)
	xTipControl.Left = xCtrl.Left + xCtrl.Width
	xTipControl.Top = xCtrl.Top + xCtrl.Height
	xTipControl.Caption = xTip
	xTipControl.Visible = True
End Sub

This code hides the tooltip:

 ' xTipControl : control which is being used to 
' display the tip.
Public Sub HideTip(xTipControl As Control)
	xTipControl.Visible = False
End Sub

Place the ShowTip function in the MouseMove event of the control(s) for which you want to display a tip. Place the HideTip function in the other control(s) for which you don't want to display a tip:

 Sub Command1_MouseMove (Button As Integer, _
	Shift As Integer, X As Single, Y As Single)
	ShowTip "Command1", Command1, SSPanel1
End Sub

Sub Command2_MouseMove (Button As Integer, _
	Shift As Integer, X As Single, Y As Single)
	ShowTip "Command2", Command2, SSPanel1
End Sub

Sub Form_MouseMove (Button As Integer, _
	Shift As Integer, X As Single, Y As Single)
'No tooltip for form
	HideTip Text1
End Sub
Andy McInturff
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date