Click to See Complete Forum and Search --> : ToolTipText


regis
May 29th, 2001, 12:35 PM
Is't possible to have many line in yellow box (ToolTipText) I tryed with & vbCrLf & but is not good.I have a big sentence to put in ToolTipText.

Some body have an idea?

Thanks
Redg

ant
May 29th, 2001, 01:59 PM
Try This:

Private Sub Form_Load()
Dim ch
Dim par
ch = Chr$(10)
par = "Hello" ' First Line
par = par & ch & "This is tool tip text" ' Second Line
Label1.TooltipText = par
End Sub

Hope this helps

--bug

coolbiz
May 29th, 2001, 02:39 PM
I wonder if you can create you own tooltip box. You can create a label (set all the properties like border, backcolor, forcolor, font and etc as needed) and make it invisible initially. Then trap the controls MouseOver() or MouseMove() events to display the label. Since those events capture the X and Y coordinates, then you can move the label to that point and it becomes a ToolTipText :)

-Cool Bizs

nederlof
May 29th, 2001, 02:43 PM
Hmm... it seems that it just won't let you use a multiline tooltiptext.

I can think of two alternatives:
1. Do something with the MouseMove event, which is quite elaborate, but I think should work.
2. Use the control's MouseIcon property, although I'm afraid there is a limit on the size of the icon you want to show.

Leo

ohad21
May 29th, 2001, 03:54 PM
Hi, There is an option to Redefine the Tool Tip in VB.
But it needs alot of api's calls and it is quite long.
My Email is ohad21@yahoo.com send me an email and i will replay to you with a Sample that works that i found on the web.It has the class module and 2 module and how to implement it.
I hope this help's.
Ohad

Cubbie
May 30th, 2001, 07:50 AM
In the pre-tooltip days this is the way I did it. Use the MouseMove event of the object to pop up a label (visible = true) with the tool tip. If you have just one long tip use just one fixed label, otherewise set the coordinates of the label each time in the MouseMove event of the object. Don't forget to set the label to visible = false for the objects around it so the tool tip dissappears when you move off of the object. Set the label up as follows:
BorderStyle = 1
Autosize = true
Appearance = 0
Wordwrap = True
Backcolor = &H80000018&


private Sub Command1_MouseMove(Button as Integer, Shift as Integer, X as Single, Y as Single)
Label1.Visible = true
DoEvents
End Sub


private Sub Form_Load()
Label1.Caption = "This is a very long Tool Tip. This is a very long Tool Tip.This is a very long Tool Tip. This is a very long Tool Tip. This is a very long Tool Tip. This is a very long Tool Tip. This is a very long Tool Tip. This is a very long Tool Tip. This is a very long Tool Tip. This is a very long Tool Tip. This is a very long Tool Tip. This is a very long Tool Tip. This is a very long Tool Tip. This is a very long Tool Tip. This is a very long Tool Tip. This is a very long Tool Tip. This is a very long Tool Tip. This is a very long Tool Tip. This is a very long Tool Tip. This is a very long Tool Tip. This is a very long Tool Tip. This is a very long Tool Tip. This is a very long Tool Tip. This is a very long Tool Tip. This is a very long Tool Tip."

End Sub


private Sub Form_MouseMove(Button as Integer, Shift as Integer, X as Single, Y as Single)
Label1.Visible = false
End Sub


private Sub Label1_Click()
Label1.Visible = false
End Sub

regis
May 30th, 2001, 08:57 AM
Thanks a lot for your solution.

But...when the tooltip appear (label1) it's was behind the other object like button or label.

I tryed to use the properties bring to front for label1 or send to back for the other object but is not good.
Thanks in advance
Régis

Cimperiali
May 30th, 2001, 09:30 AM
You can use a textbox, setting its property to be flat and having same backcolor...

Special thanks to Lothar "the Great" Haensler, Tom Archer, Chris Eastwood, Bruno Paris and all the other wonderful people who made and make Codeguru a great place. Come back soon, you Gurus.

Cubbie
May 30th, 2001, 09:31 AM
Now that you mentioned it I believe I used a Sheridan panel in lieu of a label.
Try a panel and you should be able to bring it to the front. I think a label is a lightweight control.

Cubbie

shree
May 30th, 2001, 10:12 AM
See the sample in
http://msdn.microsoft.com/vbasic/downloads/download.asp?ID=032

It might be of use in creating your own tool tips