I've finally finished the new ToolTip Library
Note! You will need latest AutoHotkey or AutoHotkey_H to use these functions.
For AutoHokey TT() requires also _Struct and sizeof and following function:
Struct(Structure,pointer:=0,init:=0){ return new _Struct(Structure,pointer,init) }
In AutoHotkey_H build-in Struct function is used so it has no dependencies and #inlclude <_Struct>
can be deleted or commented out.
Thanks to Chris and Lexikos for AHK[_L] and everybody else for helpful posts in forum-
Enjoy
Gosub, Example1 ;Simple ToolTip Gosub, Example2 ;Links in ToolTip Gosub, Example3 ;ToolTips for Controls Gosub, Example4 ;ToolTip follows mouse Gosub, Example5 ;View Icons included in dll ~Esc::ExitApp ;------------------------------------------------- Example1: TT:=TT("Icon=1","text","Title") ;create a ToolTip Loop 50 { TT.Show() ;show ToolTip at mouse coordinates Sleep, 50 } TT.Remove() ;delete ToolTip MsgBox ToolTip Deleted, click ok for next ToolTip example Return ;------------------------------------------------- Example2: TT:=TT("CloseButton OnClick=TT_Msg OnClose=TT_MsgClose" ,"<a click>Click Me</a>`n<a Second action>Click Me Too</a>" ,"Title (Click close Button to proceed)") TT.Show() Exit TT_Msg(TT,option){ MsgBox % option } TT_MsgClose(TT){ SetTimer, Example3,-100 } ;------------------------------------------------- Example3: TT:=TT("GUI=1") Gui,Add,Edit,,I'm an Edit Box TT.Add("Edit1","Edit Control","Center RTL HWND") Gui,Add,Button,,I'm a Button TT.Add("Button1","<a>You can't click me :)</a>","PARSELINKS") Gui,Show Return GuiClose: Gui,Destroy TT_Remove() ;remove all tooltips ;------------------------------------------------- Example4: TT:=TT("ClickTrough Balloon" ,"" ,"ClickTrough activated (Hold Ctrl and clict trough ToolTip)") ;create new tooltip TT.Color("White","Black") Loop 100 { If !GetKeyState("Ctrl","P") TT.Show(A_Hour ":" A_Min ":" A_Sec) Sleep 50 } TT.Remove() ;------------------------------------------------- Example5: i:=0 File:="c:\Windows\system32\shell32.dll" TT:=TT("OnClick=TTmsg OnClose=TTMsgClose CloseButton") TT.Show("<a>Click Me</a>`nhello there I'm a ToolTip`n`nPress Ctrl & + or Ctrl & - to see icons of:`n" File ;Text ,"","" ;x and y coordinates ,"ToolTip Title") ;Title Return ^+:: ^-:: If A_ThisHotkey=^+ i++ else i-- TT.Show("You are currently watching icons in`n<a>" File "</a>`n<a newFile>>>> Select another file</a>" ,"","" ,"Icon Number: " i ,File,i) ;iconFile and icon index Return TTMsg(TT,key){ global File If key= ExitApp else if key=newFile FileSelectFile,File,,%A_WinDir%\system32\,Select a file,*.dll;*.exe;*.* else if key=Click Me MsgBox % key else Run % "explorer.exe /e,/n,/select," key } TTMsgClose(TT){ ExitApp } Return
- Update -
03.09.2015 - Update Delay parameters
02.09.2012 - Updated to use Struct() instead of new _Struct(), changed OnClick,OnShow,OnClose to use object as first parameter. Updated example
01.04.2012 - Fix setting text in structure when no text given
02.03.2012 - Fix for v2 31++
18.02.2012 - V2 version.
03.01.2012 - Fixed positioning of ToolTip when using .Show() without x/y parameters.
09.02.2011 - added Font support, thanks majkinetor
05.02.2011 - x64 support
02.12.2010 - Updated TT_GetIcon to recevie hIcon from png, jpg, gif and even hex string (IconIndex must be empty string to use those "")
- Many thanks to Sean and SKAN -> How to convert image data
24.11.2010 - Changed .Hide() to use TTM_TrackPosition()