Results 1 to 8 of 8

Thread: How can I show two or more lines in a ToolTipText ?

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Nov 2000
    Location
    Maceió,Al - Brazil
    Posts
    30

    Question

    Hi Friends,

    I'd like to know how to show two or more lines in ToolTipText as we have when pointing to a Word file in Windows Explorer. I've tried VbCr and VbCrLf but none has worked.

    Thanks in advance for any help.

    Fernando.

  2. #2
    _______ HeSaidJoe's Avatar
    Join Date
    Jun 1999
    Location
    Canada
    Posts
    3,946

    <?>

    Code:
    '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 Label1_MouseMove(Button As Integer, _
    Shift As Integer, X As Single, Y As Single)
       
       Label1.Visible = False
       
    End Sub
    
    'use this code in any control near the label as you want to capture
    'the event when off the label
    Private Sub Form_MouseMove(Button As Integer, _
    Shift As Integer, X As Single, Y As Single)
       
       Label1.Visible = False
       
    End Sub
    "A myth is not the succession of individual images,
    but an integerated meaningful entity,
    reflecting a distinct aspect of the real world."

    ___ Adolf Jensen

  3. #3
    Frenzied Member Jop's Avatar
    Join Date
    Mar 2000
    Location
    Amsterdam, the Netherlands
    Posts
    1,986
    Check this great example for a lot of tooltip-madness
    http://perso.wanadoo.fr/vbfrood/engl...s/tooltips.htm
    Jop - validweb.nl

    Alcohol doesn't solve any problems, but then again, neither does milk.

  4. #4
    Fanatic Member Jerry Grant's Avatar
    Join Date
    Jul 2000
    Location
    Dorset, UK
    Posts
    810

    Wink

    Take a look at the following site:

    http://welcome.to/fastlib

    This has loads of controls, free!!!!! and one is a multiline baloon type tooltip.

    Well worth a visit.
    Jerry Grant................tnarG yrreJ
    Website: <JG-Design></.net>
    Email: [email protected]
    Working towards a bug free world......
    (Not a Microsoft employee)

  5. #5
    PowerPoster Static's Avatar
    Join Date
    Oct 2000
    Location
    Rochester, NY
    Posts
    9,390

    Wink Excellent....

    Just as an added thought...

    take out the Label1.BackStyle = 0
    then...
    set Autosize = true
    Alignment = 2 - Center
    Appearence = 0 - Flat
    BackColor = &H00C0FFFF&
    Backstyle = 1 - Opaque
    Borderstyle = 1 - Fixed Single

    This way it 'Looks' like tooltip!


    JPnyc rocks!! (Just ask him!)
    If u have your answer please go to the thread tools and click "Mark Thread Resolved"

  6. #6
    PowerPoster Static's Avatar
    Join Date
    Oct 2000
    Location
    Rochester, NY
    Posts
    9,390

    Talking ooo!

    Just started to "play" with the code....

    change:
    Code:
         Label1.Top = Command1.Top + Command1.Height
         Label1.Left = Command1.Left + Command1.Width / 2
    to:

    Code:
         Label1.Top = Command1.Top + Command1.Height + Y
         Label1.Left = Command1.Left + X
    Then the ToolTag follows the mouse and appears a 'little' more natural

    Just having fun!

    :P


    JPnyc rocks!! (Just ask him!)
    If u have your answer please go to the thread tools and click "Mark Thread Resolved"

  7. #7
    PowerPoster Static's Avatar
    Join Date
    Oct 2000
    Location
    Rochester, NY
    Posts
    9,390

    Exclamation Ok..I am going a little 'Nuts' But.....

    I found a problem:

    A label cant be 'Over' any controls!
    Therefore in a restricted space (lots of othe buttons etc) it wont show up..it will be partially under something else:

    Workaround!

    Create a frame...then drop the Label1 into the frame.
    ste the frame to have:
    No border
    Visible = false
    Then put this in:
    Code:
         Label1.Left = 0
         Label1.Top = 0
         Frame1.Width = Label1.Width
         Frame1.Height = Label1.Height
         Frame1.Top = Command1.Top + Command1.Height + Y
         Frame1.Left = Command1.Left + X
         Frame1.Visible = True
    Be sure to re-set the label1.visible back to true

    then wherever it says Label1.visible change it to Frame1.visible. (because when the frame is not visibel...neither are any controls in it)

    Viola! You have a Tooltip...multiline...floating over other controls!

    Hope this is of USE to SOMEONE!


    JPnyc rocks!! (Just ask him!)
    If u have your answer please go to the thread tools and click "Mark Thread Resolved"

  8. #8
    _______ HeSaidJoe's Avatar
    Join Date
    Jun 1999
    Location
    Canada
    Posts
    3,946

    <?>

    Code I had but don't use.
    I'll add your changes to it.


    "A myth is not the succession of individual images,
    but an integerated meaningful entity,
    reflecting a distinct aspect of the real world."

    ___ Adolf Jensen

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width