I've improved it so that setting a tooltip is even easier.
;Just supply text, variable, classnn, or hwnd and the text for the tip: setTip("Button1", "This button does absolutely nothing.") ;using the classnn setTip("Ok", "Begin the Process") ;using the caption setTip("Cancel", "Cancel Whatever is Happening!") setTip(DDL, "Dropdownlist") ;using the variable setTip(MYEdit, "The infamous edit control") ;using the hwndTo clear a tip for a certain control, just call it again without text:
setTip("Ok", "") ;this clears the tipTo change the tip for a control, call it again with different text:
setTip("Ok", "New text for the tip") ;this updates the tip textTooltips are enabled by default. To disable tooltips at any time, call:
TipsState(0) ;disable tooltips TipsState(1) ;enable tooltips again
The standard version tooltips uses standard windows tooltips.
tooltipV2.ahk >>Standard Version Download<<
Standard Version Demo:
;*************gui1********************* Gui, Add, Button,,Click to do nothing Gui, Add, DropDownList,vDDL,red|blue|green|| Gui, Add, Checkbox,, Click to enable Gui, Add, Edit, HwndMYEdit,This is an edit box Gui, Add, Button,, Ok Gui, Add, Button, x+ yp, Cancel Gui, Add, Button, x+ yp, Retry Gui, Show,x200 ;set tooltips for each button - supply text, variable, classnn, or hwnd setTip("Button1", "This button does absolutely nothing.") ;using the classnn setTip("Ok", "Begin the Process") ;using the caption setTip("Cancel", "Cancel Whatever is Happening!") setTip("Retry", "Do Over") setTip("Click to enable", "Checkbox") setTip(DDL, "Dropdownlist") ;using the variable setTip(MYEdit, "The infamous edit control") ;using the hwnd ;*************gui2********************* Gui, 2:Add, Button,,Click to do nothing Gui, 2:Add, DropDownList,vDDL2,red|blue|green|| Gui, 2:Add, Checkbox,, Click to enable Gui, 2:Add, Edit, HwndMYEdit2,This is edit box two Gui, 2:Add, Button,, Ok Gui, 2:Add, Button, x+ yp, Cancel Gui, 2:Add, Button, x+ yp, Retry Gui, 2:Show,x400 ;set tooltips for each button - supply text, variable, classnn, or hwnd setTip("Button1", "This button does absolutely nothing. gui2", 2) ;using the classnn setTip("Ok", "Begin the Process gui2", 2) ;using the caption setTip("Cancel", "Cancel Whatever is Happening! gui2", 2) setTip("Retry", "Do Over gui2", 2) setTip("Click to enable", "Checkbox gui2", 2) setTip(DDL2, "Dropdownlist part two: This time it's personal", 2) ;using the variable setTip(MYEdit2, "The infamous edit control redeux", 2) ;using the hwnd ;TipsState(0) ;disable tooltips Return #Include tooltipV2.ahk 2guiClose: guiClose: ExitApp Return
Alternate version allows use of an image and custom text and background colors. (Can also mimic standard windows tooltips.)
tooltipV2a.ahk >>Alternate Version Download<<
See the comments in tooltipV2a.ahk for version specific usage instructions.
Alternate Version Demo:
;*************gui1********************* Gui, Add, Button,,Click to do nothing Gui, Add, DropDownList,vDDL,red|blue|green|| Gui, Add, Checkbox,, Click to enable Gui, Add, Edit, HwndMYEdit,This is an edit box Gui, Add, Button,, Ok Gui, Add, Button, x+ yp, Cancel Gui, Add, Button, x+ yp, Retry Gui, Show,x200 setTip_Defaults("", "FontArial s15 C0xAA0000 BGC0xFF9B9B", "shell32.dll", "Icon24") ;set tooltips for each button - supply text, variable, classnn, or hwnd setTip("Ok", "Why would you ever need a tooltip that looks like this?", "", "", "", "Icon24") ;imgoptions are "x, y, icon, altsubmit, ..." ;using the classnn setTip("Retry", "Maybe do something again.", "", "", "", "Icon147") ;use imgOptions to set a different icon setTip("Cancel", " ", "", "", "", "Icon132") ;use imgOptions to set a different icon setTip("Click to enable", "Click to do something.", "", "", " ") ;use blank imgPath to show no icon if default already set setTip(MYEdit, "The infamous edit control", "", "", " ") ;use blank imgPath to show no icon if default already set setTip(DDL, "Dropdownlist: for to drop down lists") ;icon not given, using default setTip("Button1", "This button does absolutely nothing.", "", "", "", "Icon222") ;Change to diff icon again ;*************gui2********************* Gui, 2:Add, Button,,Click to do nothing Gui, 2:Add, DropDownList,vDDL2,red|blue|green|| Gui, 2:Add, Checkbox,, Click to enable Gui, 2:Add, Edit, HwndMYEdit2,This is edit box two Gui, 2:Add, Button,, Ok Gui, 2:Add, Button, x+ yp, Cancel Gui, 2:Add, Button, x+ yp, Retry Gui, 2:Show,x400 ;set tooltips for each button - supply text, variable, classnn, or hwnd setTip("Ok", "Why would you ever need a tooltip that looks like this?", "2") ;on guis other than 1, have to give the gui number - Gui 2 uses all default settings setTip("Retry", "Maybe do something again.", "2") setTip("Cancel", "Cancel whatever is happening.", "2") ;~ TipsState(0) ;disable tooltips Return #Include tooltipV2a.ahk 2guiClose: guiClose: ExitApp Return