Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

(SOLVED) gui control tooltip on hover?


  • Please log in to reply
16 replies to this topic
jleslie48
  • Members
  • 145 posts
  • Last active: Sep 28 2017 07:13 PM
  • Joined: 29 Jun 2010

I created a function along the lines of Alpha Bravo's suggestion. It worked fairly well but it was not ideal. I asked for help modifying it:
<!-- l --><a class="postlink-local" href="http://www.autohotke...php?f=1&t=89341">viewtopic.php?f=1&t=89341</a><!-- l -->
And Pulover was kind enough to point out the context-senstive help example script at the bottom of the GUI doc page:
<!-- m -->http://www.autohotke...ommands/Gui.htm<!-- m -->
A modified version of this script suits my needs perfectly:

Gui, Add, Edit, vMyEdit
MyEdit_TT := "This is a tooltip for the control whose variable is MyEdit."
Gui, Add, DropDownList, vMyDDL, Red|Green|Blue
MyDDL_TT := "Choose a color from the drop-down list."
Gui, Add, Checkbox, vMyCheck, This control has no tooltip.
Gui, Show
OnMessage(0x200, "WM_MOUSEMOVE")
return

WM_MOUSEMOVE()
{
    static CurrControl, PrevControl, _TT  ; _TT is kept blank for use by the ToolTip command below.
    CurrControl := A_GuiControl
    If (CurrControl <> PrevControl and not InStr(CurrControl, " "))
    {
        ToolTip  ; Turn off any previous tooltip.
        SetTimer, DisplayToolTip, 1000
        PrevControl := CurrControl
    }
    return

    DisplayToolTip:
    SetTimer, DisplayToolTip, Off
    ToolTip % %CurrControl%_TT  ; The leading percent sign tell it to use an expression.
    SetTimer, RemoveToolTip, 3000
    return

    RemoveToolTip:
    SetTimer, RemoveToolTip, Off
    ToolTip
    return
}


GuiClose:
ExitApp
Thanks to all for their patient assistance.

 

 

 

 

OK, I just

1) cut and paste this example into is own file and i works perfectly.

2) was able to work the functional parts into my own AHK perfectly.

 

thanks to all that made this example.  

 

- Jon



KCzx3
  • Members
  • 22 posts
  • Last active: Oct 07 2015 02:31 AM
  • Joined: 09 Jun 2015

Sorry for bumping this but can anyone confirm that this does or does not work for Text controls?  I am finding that it doesn't.