Consulting

Results 1 to 10 of 10

Thread: Control Tip Text

  1. #1
    VBAX Regular
    Joined
    Aug 2019
    Posts
    54
    Location

    Control Tip Text

    Hi to all . How do I add a row in the control tip text ? scr(52) scr52.jpg Ragards Kostas

  2. #2
    Moderator VBAX Sage SamT's Avatar
    Joined
    Oct 2006
    Location
    Near Columbia
    Posts
    7,814
    Location
    I don't think you can.

    I can think of a long work around. In fact. I used something similar when I wanted an instruction label overlaid the control. I used input validation to position and show the label(s), and the Label_Click Event to unload it. But I think you will need to use a less User friendly method.

    You can use MouseDown + Button|+Ctrl|+Alt|+Shift to load the label.
    I expect the student to do their homework and find all the errrors I leeve in.


    Please take the time to read the Forum FAQ

  3. #3
    Knowledge Base Approver VBAX Wizard p45cal's Avatar
    Joined
    Oct 2005
    Location
    Surrey UK
    Posts
    5,875
    Taking on SamT's idea, see attached.

    Uses labels whose Visible property is originally set to False.
    Textbox Mouseover event to show a label
    Userform Mouseover event to hide them.
    Attached Files Attached Files
    p45cal
    Everyone: If I've helped and you can't be bothered to acknowledge it, I can't be bothered to look at further posts from you.

  4. #4
    VBAX Regular
    Joined
    Aug 2019
    Posts
    54
    Location
    Hi Thank you for your answer and for the example ,but where can i'll find the three little dots, so to make the multi line row?
    Regards

  5. #5
    Knowledge Base Approver VBAX Wizard p45cal's Avatar
    Joined
    Oct 2005
    Location
    Surrey UK
    Posts
    5,875
    Those 3 dots are an ellipsis which I get by holding down the left Alt key and typing 0133 on the number pad.
    However, this has nothing to do with making this multiline.
    Use Ctrl + Return to get a new line on a label control.
    Last edited by p45cal; 12-01-2019 at 04:33 PM.
    p45cal
    Everyone: If I've helped and you can't be bothered to acknowledge it, I can't be bothered to look at further posts from you.

  6. #6
    VBAX Regular
    Joined
    Aug 2019
    Posts
    54
    Location
    Thank you very much for your help.
    The last question (i hope) is how can i get the (Ctrl + Return) in run time, so to create a dynamic label? and i want to visible the label in some time and when the time expire ,the label be visible=false again
    Regards

  7. #7
    Knowledge Base Approver VBAX Wizard p45cal's Avatar
    Joined
    Oct 2005
    Location
    Surrey UK
    Posts
    5,875
    eg.:
    Label1.Caption = "First line" & vbLf & "SecondLine" & vbLf & "third line"


    re:
    Quote Originally Posted by ksilenio View Post
    to visible the label in some time and when the time expire ,the label be visible=false againRegards
    Difficult/convoluted!
    Last edited by p45cal; 12-01-2019 at 04:33 PM.
    p45cal
    Everyone: If I've helped and you can't be bothered to acknowledge it, I can't be bothered to look at further posts from you.

  8. #8
    Moderator VBAX Sage SamT's Avatar
    Joined
    Oct 2006
    Location
    Near Columbia
    Posts
    7,814
    Location
    i want to visible the label in some time and when the time expire ,the label be visible=false again
    not hard, convoluted, not very User Friendly compared to mouse click and mouseMove
    I expect the student to do their homework and find all the errrors I leeve in.


    Please take the time to read the Forum FAQ

  9. #9
    VBAX Sage
    Joined
    Apr 2007
    Location
    United States
    Posts
    8,726
    Location
    You can Add and Remove the 'tooltip' labels at run time


    Option Explicit
    
    
    Dim bTooltip As Boolean
    
    
    
    
    Private Sub UserForm_Initialize()
        bTooltip = False
    End Sub
    
    
    
    
    Private Sub TextBox1_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
        Call AddToolTip(TextBox1, "This is line 1" & vbLf & "This is line 2")
    End Sub
    
    
    
    
    Private Sub TextBox2_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
        Call AddToolTip(TextBox2, "This is aaaaaaaaaaaaaaaaaaaaaaaaaaaaa line 3" & vbLf & "This is bbbbbbbbbbbbbbbbbbb line 4" & vbLf & _
            "This is cccccccccccccccc line 5" & vbLf & "This is dddddddd line 6")
    End Sub
    
    
    
    
    Private Sub UserForm_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
        Dim oControl As MSForms.Control
        
        If Not bTooltip Then Exit Sub
        
        For Each oControl In Controls
            If TypeName(oControl) = "Label" Then
                If oControl.Name Like "*_Tooltip" Then
                    Me.Controls.Remove oControl.Name
                End If
            End If
        Next
        
        bTooltip = False
    End Sub
    
    
    
    
    Private Sub AddToolTip(ctrl As MSForms.Control, Tooltip As String)
        Dim oLabel As MSForms.Label
        
        Set oLabel = Me.Controls.Add("Forms.Label.1", ctrl.Name & "_Tooltip", True)
    
    
        With oLabel
            .BackColor = &HE1FFFF
            .Caption = Format(Time, "hh:mm:ss") & vbLf & vbLf & Tooltip
            .Left = ctrl.Left + 10
            .Top = ctrl.Top + 10
            .BorderStyle = fmBorderStyleSingle
            .Enabled = True
            .WordWrap = False
            .AutoSize = True
        End With
    
    
        bTooltip = True
    
    
    End Sub
    
    
    Private Sub CommandButton1_Click()
        Me.Hide
        Unload Me
    End Sub
    Attached Files Attached Files
    ---------------------------------------------------------------------------------------------------------------------

    Paul


    Remember: Tell us WHAT you want to do, not HOW you think you want to do it

    1. Use [CODE] ....[/CODE ] Tags for readability
    [CODE]PasteYourCodeHere[/CODE ] -- (or paste your code, select it, click [#] button)
    2. Upload an example
    Go Advanced / Attachments - Manage Attachments / Add Files / Select Files / Select the file(s) / Upload Files / Done
    3. Mark the thread as [Solved] when you have an answer
    Thread Tools (on the top right corner, above the first message)
    4. Read the Forum FAQ, especially the part about cross-posting in other forums
    http://www.vbaexpress.com/forum/faq...._new_faq_item3

  10. #10
    VBAX Regular
    Joined
    Aug 2019
    Posts
    54
    Location
    Thank you all for your answers
    Regards

Posting Permissions

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