Tooltiptext msg. for Label caption


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 8 of 8

Thread: Tooltiptext msg. for Label caption

  1. #1
    Jodi Guest

    Tooltiptext msg. for Label caption


    I am trying to get the tooltiptext msg. of a command to display over a label.caption
    when you pause the mouse pointer over the command.
    Does anyone know how to do this?
    Thanks,
    Jodi

  2. #2
    Aleksandr Guest

    Re: Tooltiptext msg. for Label caption


    Yep, you must include this code in the (assuming control's name is command1)

    Private Sub Command1_MouseMove......
    Label1.caption = command1.TooltipText
    End Sub

    Hope it can help you...
    Aleksandr

    "Jodi" <JMcKay@hotmail.com> wrote:
    >
    >I am trying to get the tooltiptext msg. of a command to display over a label.caption
    >when you pause the mouse pointer over the command.
    >Does anyone know how to do this?
    >Thanks,
    >Jodi



  3. #3
    Jodi Guest

    Re: Tooltiptext msg. for Label caption


    Aleksandr,
    Thanks! Your code works fine. But when I move the mouse away from the command
    the tooltiptext msg. still in the label.caption. Do you have any idea how
    I can fix that.

    Jodi


    "Aleksandr" <aca@mailops.com> wrote:
    >
    >Yep, you must include this code in the (assuming control's name is command1)
    >
    >Private Sub Command1_MouseMove......
    > Label1.caption = command1.TooltipText
    >End Sub
    >
    >Hope it can help you...
    >Aleksandr
    >
    >"Jodi" <JMcKay@hotmail.com> wrote:
    >>
    >>I am trying to get the tooltiptext msg. of a command to display over a

    label.caption
    >>when you pause the mouse pointer over the command.
    >>Does anyone know how to do this?
    >>Thanks,
    >>Jodi

    >



  4. #4
    Aleksandr Guest

    Re: Tooltiptext msg. for Label caption


    The quickest i can by now is to code the MouseOver event for the form, so
    when the mouse pointer is over leaves the command button, the caption changes
    to a default. This way you can get a descriptive text for every object
    in your form.

    Aleksandr

    "Jodi" <JMcKay@hotmail.com> wrote:
    >
    >Aleksandr,
    >Thanks! Your code works fine. But when I move the mouse away from the command
    >the tooltiptext msg. still in the label.caption. Do you have any idea how
    >I can fix that.
    >
    >Jodi
    >
    >
    >"Aleksandr" <aca@mailops.com> wrote:
    >>
    >>Yep, you must include this code in the (assuming control's name is command1)
    >>
    >>Private Sub Command1_MouseMove......
    >> Label1.caption = command1.TooltipText
    >>End Sub
    >>
    >>Hope it can help you...
    >>Aleksandr
    >>
    >>"Jodi" <JMcKay@hotmail.com> wrote:
    >>>
    >>>I am trying to get the tooltiptext msg. of a command to display over a

    >label.caption
    >>>when you pause the mouse pointer over the command.
    >>>Does anyone know how to do this?
    >>>Thanks,
    >>>Jodi

    >>

    >



  5. #5
    Eric D. Burdo Guest

    Re: Tooltiptext msg. for Label caption

    What MouseOver event? If you are referring to the MouseMove event, it only catches
    movement over the control. Nothing when it leaves the control. Also, if you move the
    mouse fast it does not catch all the movements.

    You may have to check into the SetCapture and ReleaseCapture API's, but if I am correct, I
    do not think those will work. I think they require a window handle and Labels do not have
    window handles.

    You could put this in the Form_MouseMove event: label1.Caption = vbNullString
    It is not very efficient, but it does sorta work. It is truly a bad bandaid, so I
    apologise in advance for suggesting it.

    --

    Eric D. Burdo, Red-Leif International
    VB Programmer and Consultant
    <http://www.redleif.com/vb>

    *** Please reply to the newsgroup so all can benefit. ***


    "Aleksandr" <aca@mailops.com> wrote in message news:39f4964e$1@news.devx.com...
    >
    > The quickest i can by now is to code the MouseOver event for the form, so
    > when the mouse pointer is over leaves the command button, the caption changes
    > to a default. This way you can get a descriptive text for every object
    > in your form.
    >
    > Aleksandr
    >
    > "Jodi" <JMcKay@hotmail.com> wrote:
    > >
    > >Aleksandr,
    > >Thanks! Your code works fine. But when I move the mouse away from the command
    > >the tooltiptext msg. still in the label.caption. Do you have any idea how
    > >I can fix that.
    > >
    > >Jodi
    > >
    > >
    > >"Aleksandr" <aca@mailops.com> wrote:
    > >>
    > >>Yep, you must include this code in the (assuming control's name is command1)
    > >>
    > >>Private Sub Command1_MouseMove......
    > >> Label1.caption = command1.TooltipText
    > >>End Sub
    > >>
    > >>Hope it can help you...
    > >>Aleksandr
    > >>
    > >>"Jodi" <JMcKay@hotmail.com> wrote:
    > >>>
    > >>>I am trying to get the tooltiptext msg. of a command to display over a

    > >label.caption
    > >>>when you pause the mouse pointer over the command.
    > >>>Does anyone know how to do this?
    > >>>Thanks,
    > >>>Jodi
    > >>

    > >

    >




  6. #6
    Jodi Guest

    Re: Tooltiptext msg. for Label caption


    Eric,
    I tried your suggestion and it works. But in some cases it doesn't remove
    the text in the label.caption. For example, if the commandbutton was in a
    frame you need to move the mouse out of the frame before it can clear the
    label.caption. I guess you are right, "It does sorta work." :-)

    Thanks,
    Jodi

    "Eric D. Burdo" <vbtips@redleif.com> wrote:
    >What MouseOver event? If you are referring to the MouseMove event, it only

    catches
    >movement over the control. Nothing when it leaves the control. Also, if

    you move the
    >mouse fast it does not catch all the movements.
    >
    >You may have to check into the SetCapture and ReleaseCapture API's, but

    if I am correct,
    >I
    >do not think those will work. I think they require a window handle and

    Labels do not
    >have
    >window handles.
    >
    >You could put this in the Form_MouseMove event: label1.Caption = vbNullString
    >It is not very efficient, but it does sorta work. It is truly a bad bandaid,

    so I
    >apologise in advance for suggesting it.
    >
    >--
    >
    >Eric D. Burdo, Red-Leif International
    >VB Programmer and Consultant
    ><http://www.redleif.com/vb>
    >
    >*** Please reply to the newsgroup so all can benefit. ***
    >
    >
    >"Aleksandr" <aca@mailops.com> wrote in message news:39f4964e$1@news.devx.com...
    >>
    >> The quickest i can by now is to code the MouseOver event for the form,

    so
    >> when the mouse pointer is over leaves the command button, the caption

    changes
    >> to a default. This way you can get a descriptive text for every object
    >> in your form.
    >>
    >> Aleksandr
    >>
    >> "Jodi" <JMcKay@hotmail.com> wrote:
    >> >
    >> >Aleksandr,
    >> >Thanks! Your code works fine. But when I move the mouse away from the

    command
    >> >the tooltiptext msg. still in the label.caption. Do you have any idea

    how
    >> >I can fix that.
    >> >
    >> >Jodi
    >> >
    >> >
    >> >"Aleksandr" <aca@mailops.com> wrote:
    >> >>
    >> >>Yep, you must include this code in the (assuming control's name is command1)
    >> >>
    >> >>Private Sub Command1_MouseMove......
    >> >> Label1.caption = command1.TooltipText
    >> >>End Sub
    >> >>
    >> >>Hope it can help you...
    >> >>Aleksandr
    >> >>
    >> >>"Jodi" <JMcKay@hotmail.com> wrote:
    >> >>>
    >> >>>I am trying to get the tooltiptext msg. of a command to display over

    a
    >> >label.caption
    >> >>>when you pause the mouse pointer over the command.
    >> >>>Does anyone know how to do this?
    >> >>>Thanks,
    >> >>>Jodi
    >> >>
    >> >

    >>

    >
    >



  7. #7
    Aleksandr Guest

    Re: Tooltiptext msg. for Label caption


    Excuse me, when I wrote MouseOver I've meant MouseMove. The trick i was
    suggesting was to set the label caption to the appropriate tooltip when the
    Mouse is over the command button, else, a different message should be displayed
    in the label's caption. The easy way to know if the mouse leaves command
    button is to code it in the MouseMove event of the form.

    Aleksandr.

    "Jodi" <JMcKay@hotmail.com> wrote:
    >
    >Eric,
    >I tried your suggestion and it works. But in some cases it doesn't remove
    >the text in the label.caption. For example, if the commandbutton was in

    a
    >frame you need to move the mouse out of the frame before it can clear the
    >label.caption. I guess you are right, "It does sorta work." :-)
    >
    >Thanks,
    >Jodi
    >
    >"Eric D. Burdo" <vbtips@redleif.com> wrote:
    >>What MouseOver event? If you are referring to the MouseMove event, it

    only
    >catches
    >>movement over the control. Nothing when it leaves the control. Also, if

    >you move the
    >>mouse fast it does not catch all the movements.
    >>
    >>You may have to check into the SetCapture and ReleaseCapture API's, but

    >if I am correct,
    >>I
    >>do not think those will work. I think they require a window handle and

    >Labels do not
    >>have
    >>window handles.
    >>
    >>You could put this in the Form_MouseMove event: label1.Caption = vbNullString
    >>It is not very efficient, but it does sorta work. It is truly a bad bandaid,

    >so I
    >>apologise in advance for suggesting it.
    >>
    >>--
    >>
    >>Eric D. Burdo, Red-Leif International
    >>VB Programmer and Consultant
    >><http://www.redleif.com/vb>
    >>
    >>*** Please reply to the newsgroup so all can benefit. ***
    >>
    >>
    >>"Aleksandr" <aca@mailops.com> wrote in message news:39f4964e$1@news.devx.com...
    >>>
    >>> The quickest i can by now is to code the MouseOver event for the form,

    >so
    >>> when the mouse pointer is over leaves the command button, the caption

    >changes
    >>> to a default. This way you can get a descriptive text for every object
    >>> in your form.
    >>>
    >>> Aleksandr
    >>>
    >>> "Jodi" <JMcKay@hotmail.com> wrote:
    >>> >
    >>> >Aleksandr,
    >>> >Thanks! Your code works fine. But when I move the mouse away from the

    >command
    >>> >the tooltiptext msg. still in the label.caption. Do you have any idea

    >how
    >>> >I can fix that.
    >>> >
    >>> >Jodi
    >>> >
    >>> >
    >>> >"Aleksandr" <aca@mailops.com> wrote:
    >>> >>
    >>> >>Yep, you must include this code in the (assuming control's name is

    command1)
    >>> >>
    >>> >>Private Sub Command1_MouseMove......
    >>> >> Label1.caption = command1.TooltipText
    >>> >>End Sub
    >>> >>
    >>> >>Hope it can help you...
    >>> >>Aleksandr
    >>> >>
    >>> >>"Jodi" <JMcKay@hotmail.com> wrote:
    >>> >>>
    >>> >>>I am trying to get the tooltiptext msg. of a command to display over

    >a
    >>> >label.caption
    >>> >>>when you pause the mouse pointer over the command.
    >>> >>>Does anyone know how to do this?
    >>> >>>Thanks,
    >>> >>>Jodi
    >>> >>
    >>> >
    >>>

    >>
    >>

    >



  8. #8
    mrfelis Guest

    Re: Tooltiptext msg. for Label caption

    There are problems with trying to determine the mouse leaving a control
    using the form's MouseMove. The layout of the form may encourage the form to
    not generate a MouseMove event. (Controls may be adjorning or close to the
    edge of the form.) Also the user may move the mouse quickly.

    A more advanced approach is to use the SetCapture and ReleaseCapture API's.

    Public Declare Function SetCapture Lib "user32" (ByVal hwnd As Long) As Long
    Public Declare Function ReleaseCapture Lib "user32" () As Long

    In the MouseMove event of the command button (or any control with a hWnd),
    call SetCapture. This will send all mouse movement messages to the control
    (until the user clicks either button.) When the X and Y values are outside
    the clear the label and call ReleaseCapture.

    ie:

    Private Sub Command1_MouseMove(Button As Integer, Shift As Integer, X As
    Single, Y As Single)
    Select Case True
    Case X < 1, X > Command1.Width, Y < 1, Y > Command1.Height
    Label1.Caption = "Mouse outside"
    ReleaseCapture
    Case Else
    SetCapture Command1.hwnd
    Label1.Caption = "(" & CStr(X) & ", " & CStr(Y) & ")"
    End Select
    End Sub



    --
    ~~~
    C'Ya,
    mrfelis
    mrfelis@yahoo.NOSPAM.com
    just remove the spam
    Aleksandr <aca@mailops.com> wrote in message
    news:39f4be4f$1@news.devx.com...
    >
    > Excuse me, when I wrote MouseOver I've meant MouseMove. The trick i was
    > suggesting was to set the label caption to the appropriate tooltip when

    the
    > Mouse is over the command button, else, a different message should be

    displayed
    > in the label's caption. The easy way to know if the mouse leaves command
    > button is to code it in the MouseMove event of the form.
    >
    > Aleksandr.
    >
    > "Jodi" <JMcKay@hotmail.com> wrote:
    > >
    > >Eric,
    > >I tried your suggestion and it works. But in some cases it doesn't remove
    > >the text in the label.caption. For example, if the commandbutton was in

    > a
    > >frame you need to move the mouse out of the frame before it can clear the
    > >label.caption. I guess you are right, "It does sorta work." :-)
    > >
    > >Thanks,
    > >Jodi
    > >
    > >"Eric D. Burdo" <vbtips@redleif.com> wrote:
    > >>What MouseOver event? If you are referring to the MouseMove event, it

    > only
    > >catches
    > >>movement over the control. Nothing when it leaves the control. Also, if

    > >you move the
    > >>mouse fast it does not catch all the movements.
    > >>
    > >>You may have to check into the SetCapture and ReleaseCapture API's, but

    > >if I am correct,
    > >>I
    > >>do not think those will work. I think they require a window handle and

    > >Labels do not
    > >>have
    > >>window handles.
    > >>
    > >>You could put this in the Form_MouseMove event: label1.Caption =

    vbNullString
    > >>It is not very efficient, but it does sorta work. It is truly a bad

    bandaid,
    > >so I
    > >>apologise in advance for suggesting it.
    > >>
    > >>--
    > >>
    > >>Eric D. Burdo, Red-Leif International
    > >>VB Programmer and Consultant
    > >><http://www.redleif.com/vb>
    > >>
    > >>*** Please reply to the newsgroup so all can benefit. ***
    > >>
    > >>
    > >>"Aleksandr" <aca@mailops.com> wrote in message

    news:39f4964e$1@news.devx.com...
    > >>>
    > >>> The quickest i can by now is to code the MouseOver event for the form,

    > >so
    > >>> when the mouse pointer is over leaves the command button, the caption

    > >changes
    > >>> to a default. This way you can get a descriptive text for every

    object
    > >>> in your form.
    > >>>
    > >>> Aleksandr
    > >>>
    > >>> "Jodi" <JMcKay@hotmail.com> wrote:
    > >>> >
    > >>> >Aleksandr,
    > >>> >Thanks! Your code works fine. But when I move the mouse away from the

    > >command
    > >>> >the tooltiptext msg. still in the label.caption. Do you have any idea

    > >how
    > >>> >I can fix that.
    > >>> >
    > >>> >Jodi
    > >>> >
    > >>> >
    > >>> >"Aleksandr" <aca@mailops.com> wrote:
    > >>> >>
    > >>> >>Yep, you must include this code in the (assuming control's name is

    > command1)
    > >>> >>
    > >>> >>Private Sub Command1_MouseMove......
    > >>> >> Label1.caption = command1.TooltipText
    > >>> >>End Sub
    > >>> >>
    > >>> >>Hope it can help you...
    > >>> >>Aleksandr
    > >>> >>
    > >>> >>"Jodi" <JMcKay@hotmail.com> wrote:
    > >>> >>>
    > >>> >>>I am trying to get the tooltiptext msg. of a command to display

    over
    > >a
    > >>> >label.caption
    > >>> >>>when you pause the mouse pointer over the command.
    > >>> >>>Does anyone know how to do this?
    > >>> >>>Thanks,
    > >>> >>>Jodi
    > >>> >>
    > >>> >
    > >>>
    > >>
    > >>

    > >

    >




Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center