Link to home
Start Free TrialLog in
Avatar of vindevogel
vindevogel

asked on

Multiple lines in a ToolTipText

Is there a way to get multiple lines in a ToolTipText for a control ?

I've tried with   vbcrlf, chr$(10) , chr$(13) , chr$(10) + chr$(13), chr$(13) + chr$(13), ....

So, what I want is a tooltip like this one :

   You have two choices :
   Press <Enter> to accept or
   press <Esc> to cancel
Avatar of mcrider
mcrider

Unfortunately, tooltiptext is a "one-liner".  If you want to get around this, you have to build your own tooltips or use 3rd-party OCX.

Cheers!
Avatar of vindevogel

ASKER

McRider : I have the habit of rejecting answers to questions I post who are just saying "You can't"

This may be so .... (that I can't)

What I want is that this question remains open for some time, so people can give me ideas on how to do it.  Something like, "add 1000 spaces, he'l automatically give you a new line then ..."

Last week, I had the same thing.
https://www.experts-exchange.com/jsp/qShow.jsp?ta=visualbasic&qid=10223034 
I got a negative answer in 5 minutes, and a solution one hour later !!

If no-one gets me an answer I'll reward the points anyway, don't worry.
You can't have multiline tooltips but you can use the tag tip in place of the tip.
it works like this.

'create multil line tag tips...same use as tool tips except
'that with tool tips you are restricted to one line..
'with tag tips you get multiline
'remember to set the height and width of your label to fit your
'message
'
'this example uses a command button (command1) & a label (label1)
'
'on mouse over the command button the tool tag is displayed
'
Private Sub Form_Load()
   
   Label1.BackStyle = 0    'or 1 and set the backcolor to tooltip color
   Label1.Visible = False
   
End Sub

Private Sub Command1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
     
     Dim msg$
     msg$ = "Tag tips for the beginner." & vbCrLf
     msg$ = msg$ & "Multil Line Tag Tips Made Easy" & vbCrLf
     msg$ = msg$ & "Think of the possibilities!"
         
     
     Command1.Tag = msg$

     Label1.Caption = Command1.Tag
     Label1.Top = Command1.Top + Command1.Height
     Label1.Left = Command1.Left + Command1.Width / 2
     Label1.Visible = True
     
End Sub


Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
   
   Label1.Visible = False
   
End Sub
Heheh ... Juliette is back :-)

Sorry Juliette this time. I'll reject for the same reason.  Your workaround is great, but that I could figure out myself too.

To be fare : I need tooltips in both VB and on HTML pages. (Like on images)

(I try to write components to do most of my stuff, both usuable in VB as in HTML/ASP)

I would prefer one method to do it, and with standard stuff.
With your option I would have to find a method do that in HTML too ...

Same for RCRider as you: I'm willing to give you guys the points, but would have to give a "D".  I take pride in my gradings, hope you do too.
fare = fair
vindevogel,

Juilette has provided the same answer I did, except Juilette provided an example of "building your own tooltips" by using a label.

Cheers!
mcrider : I know, that's why I rejected too .....
ASKER CERTIFIED SOLUTION
Avatar of mcrider
mcrider

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
By the way, grading an answer like this with a "D" is really not fair... I had nothing to do with microsoft's creation of VB... Basically, giving a "D" is shooting the messenger...

Cheers!
No, grading your second answer as a D, would not be fair, I admit.

On your first answer, however, it would be.  I think.

The document is now on the printer.  I'll read it through.

I'm thinking two things now : I either give you the credits on this question (50p A), or I raise the points to this question to 150-200 to get me a way to trap the message (like with messagehook)
Like I said, the event is fired internally to VB, you would have to watch windows events using a timer control, and I'm not sure this would even work...

Cheers!
No no, mc, you don't watch windows events with a timer !!

I'm not going to raise the points.  I'll find another way (maybe the workaround in VB, some other stuff in ASP)

I promised the A, so you get it.
Would have given you a B though, if I hadn't promised.