[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 310
  • Last Modified:

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
0
vindevogel
Asked:
vindevogel
  • 6
  • 5
1 Solution
 
mcriderCommented:
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!
0
 
vindevogelAuthor Commented:
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.
http://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.
0
 
JuiletteCommented:
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
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
vindevogelAuthor Commented:
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.
0
 
vindevogelAuthor Commented:
fare = fair
0
 
mcriderCommented:
vindevogel,

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

Cheers!
0
 
vindevogelAuthor Commented:
mcrider : I know, that's why I rejected too .....
0
 
mcriderCommented:
This is why it can't be done without doing it yourself...

First look at this microsoft "C" KB article... It describes doing multi-line tool tips in C.

http://msdn.microsoft.com/library/sdkdoc/shellcc/commctls/tooltip/tooltip.htm


 Now, the document states you have to respond to "a TTN_GETDISPINFO notification message... To force the tooltip control to use multiple lines, send a TTM_SETMAXTIPWIDTH message" using SendMessage...

Unfortunately, the tooltip event is fired internally to visual basic and is outside the control of your program.  


Cheers!
0
 
mcriderCommented:
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!
0
 
vindevogelAuthor Commented:
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)
0
 
mcriderCommented:
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!
0
 
vindevogelAuthor Commented:
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.
0

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

  • 6
  • 5
Tackle projects and never again get stuck behind a technical roadblock.
Join Now