martin Posted July 9, 2007 Share Posted July 9, 2007 (edited) In this example, I've tried to set the visible time for a tool tip to 10 seconds. #include <guiconstants.au3> Const $TTM_SETDELAYTIME = $WM_USER + 3, $TTDT_AUTOPOP = 2 GUICreate("tooltip") $but = GUICtrlCreateButton("exit",20,20,120,20) $tt1 = GUICtrlSetTip(-1, "lots of words... but if you click the button you'll be sorry", 'Care!', 1, 1) GUICtrlSendMsg($tt1,$TTM_SETDELAYTIME,4,_MakeLong(10000,0)) GUISetState() While GUIGetMsg() <> $but WEnd Func _MakeLong($l, $h) Return BitOR(BitAnd($l, 0xFFFF), BitShift(BitAnd($h, 0xFFFF), -16)) EndFunc; _MakeLong()It doesn't work; the visible time is unchanged.The information on how to do it comes from here(at the time of posting it looks like the web site is down) Can anyone tell me how I should increase the visible time? Edited July 9, 2007 by martin Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
evilertoaster Posted July 9, 2007 Share Posted July 9, 2007 Auto3Lib has the API wrap for this. Look at _ToolTip_SetDelayTime().http://www.autoitscript.com/forum/index.php?showtopic=33677 Link to comment Share on other sites More sharing options...
martin Posted July 9, 2007 Author Share Posted July 9, 2007 (edited) Auto3Lib has the API wrap for this. Look at _ToolTip_SetDelayTime().http://www.autoitscript.com/forum/index.php?showtopic=33677Thanks eviltoaster, I've tried this but no matter what combination or messages I try it has no effect.Have you ever used this function? If so can you show me by modifying the example in my original post? Edited July 9, 2007 by martin Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
Xenobiologist Posted July 9, 2007 Share Posted July 9, 2007 Hi, here is an example: expandcollapse popup;Menu With Timed Tooltips ;Stephen Podhajecki [eltorro] gehossafats@netmdc.com ; ;Converted to GUIOnEventMode by [Sunaj] ;Changes: ; ;a) Removed need for Sleep() = smoother GUI ;B) Removed debugging engine, use original by eltorro for debugging ;c) Changed msg pull interval to be faster, no CPU usage difference noticed ;d) Works with context menus too now - hack had to be implemented because ; context menus do NOT allow for registering when mouse is moved away in ; the same way as normal menus. Works in uniform way for both type of ; menus now. ; #include <GuiConstants.au3> #include <Array.au3> Opt("GUIOnEventMode", 1) Global $USE_TOOLTIP = True Local $aCtrlArray[1], $aCtrlMsgArray[1], $ControlID, $Global_I = 0, $__ControlID, $HoverActive = 0, $Temp_Found = 0, $szTemp_Array[2] Global $defaultstatus = "Ready" Global $status Global $MenuItemId Global $IDLECounter = 0 ; When 33 is reached tooltip is closed Global $EVENT Global $TIMERENABLED = False ; Flag set when SetTimer api is called Global $TIP_TIMER ; Timestamp holder for tooltip visiblilty Global Const $TIP_TIMER_ID = 999 ; Timer id for SetTimer api Global Const $TIPSHOW = 1 ; Event Global Const $TIPVISIBLE = 2 ; Event Global Const $TIP_TTL = 10000 ; how long to show tooltip Global Const $TIP_DELAY = 333 ; how long to wait to show tooltip Global Const $MSG_INTERVAL = 33 ; Interval Windows will use to send ;Window Message Hooks. Global Const $WM_ENTERMENULOOP = 0x0211 Global Const $WM_EXITMENULOOP = 0x0212 Global Const $WM_MENUSELECT = 0x011F Global Const $WM_TIMER = 0x0113 Global Const $WM_ENTERIDLE = 0x0121 GUIRegisterMsg($WM_ENTERMENULOOP, "MenuTipHandler") GUIRegisterMsg($WM_MENUSELECT, "MenuTipHandler") GUIRegisterMsg($WM_EXITMENULOOP, "MenuTipHandler") GUIRegisterMsg($WM_ENTERIDLE, "MenuTipHandler") ; to make context menues disappear when moving pointer off menu without closing it GUIRegisterMsg($WM_TIMER, "TimerCallBack") $Form1 = GUICreate('Menu ToolTips', 400, 285) $filemenu = GUICtrlCreateMenu("&File") _AddCtrl($filemenu, "FileMenu") $file1 = GUICtrlCreateMenu("Label 1", $filemenu) $file2 = GUICtrlCreateMenuItem("Label 2", $filemenu) _AddCtrl($file2, "Label 2 at Your Service") $file3 = GUICtrlCreateMenuItem("Label3", $filemenu) _AddCtrl($file3, "Pleased to meet you from Label 3") $file4 = GUICtrlCreateMenuItem("Label 4", $filemenu) _AddCtrl($file4, "Well, you get the picture, Label 4") $statuslabel = GUICtrlCreateLabel($defaultstatus, 0, 250, 300, 16, BitOR($SS_SIMPLE, $SS_SUNKEN)) $statuslabel2 = GUICtrlCreateLabel($defaultstatus, 300, 250, 100, 16, BitOR($SS_SIMPLE, $SS_SUNKEN)) $file11 = GUICtrlCreateMenuItem("Label 11", $file1) _AddCtrl($file11, "This is Label11 subitem of Label1") $hContextmenu = GUICtrlCreateContextMenu() $hFileitem = GUICtrlCreateMenuItem("Open", $hContextmenu) _AddCtrl($hFileitem, "Works in context menuitem '$hFileitem' as well!") $hSaveitem = GUICtrlCreateMenuItem("Save", $hContextmenu) _AddCtrl($hSaveitem, "Works in context menuitem '$hSaveitem' as well!") $hInfoitem = GUICtrlCreateMenuItem("Info", $hContextmenu) _AddCtrl($hInfoitem, "Works in context menuitem '$hInfoitem' as well!") GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit") GUISetState() While 1 Sleep(333) WEnd Func EventLoop() Select Case $EVENT = $TIPSHOW If $TIP_TIMER Then If ((TimerDiff($TIP_TIMER) >= $TIP_DELAY) And ($MenuItemId > 0)) Then ShowMenuTip() EndIf Case $EVENT = $TIPVISIBLE If TimerDiff($TIP_TIMER) >= $TIP_TTL + $TIP_DELAY Then VoidMenuTip() EndSelect EndFunc ;==>EventLoop Func _AddCtrl($ControlID, $ControlMsg) _ArrayAdd($aCtrlArray, $ControlID) _ArrayAdd($aCtrlMsgArray, $ControlMsg) EndFunc ;==>_AddCtrl Func ShowMenuTip() If $TIP_TIMER > 0 Then For $x = 0 To UBound($aCtrlArray) - 1 If $MenuItemId = ($aCtrlArray[$x]) Then GUICtrlSetData($statuslabel, $aCtrlMsgArray[$x]) ToolTip($aCtrlMsgArray[$x]) $EVENT = $TIPVISIBLE $IDLECounter = 0 ExitLoop EndIf Next EndIf EndFunc ;==>ShowMenuTip Func VoidMenuTip() ToolTip("") $IDLECounter = 0 GUICtrlSetData($statuslabel, $defaultstatus) $TIP_TIMER = 0 EndFunc ;==>VoidMenuTip Func StartTimer($hWndGUI, $TimerId, $Interval) If $TIMERENABLED = True Then StopTimer($hWndGUI, $TimerId) $retval = DllCall("User32.dll", "int", "SetTimer", "hwnd", $hWndGUI, "int", $TimerId, "int", $Interval, "int", 0) $TIMERENABLED = True EndFunc ;==>StartTimer Func StopTimer($hWndGUI, $TimerId) $retval = DllCall("User32.dll", "int", "KillTimer", "hwnd", $hWndGUI, "int", $TimerId) $TIMERENABLED = False EndFunc ;==>StopTimer Func TimerCallBack($hWndGUI, $MsgID, $WParam, $LParam) Local $TimerId = BitAND($WParam, 0xFFFF) If $TimerId = $TIP_TIMER_ID Then EventLoop() Return $GUI_RUNDEFMSG EndFunc ;==>TimerCallBack Func MenuTipHandler($hWndGUI, $MsgID, $WParam, $LParam) $IDLECounter += 1 If $IDLECounter >= 3 Then ;make context tip disappear on move away ToolTip("") EndIf Local $id = BitAND($WParam, 0xFFFF) Select Case $MsgID = $WM_ENTERMENULOOP StartTimer($Form1, $TIP_TIMER_ID, $MSG_INTERVAL) Case $MsgID = $WM_MENUSELECT If $USE_TOOLTIP Then If Not ($MenuItemId = $id) Or ($MenuItemId = $id) Then $MenuItemId = $id ToolTip("") ;make tip disappear on move away $IDLECounter = 0 If $MenuItemId > 0 Then $TIP_TIMER = TimerInit() $EVENT = $TIPSHOW EndIf EndIf EndIf Case $MsgID = $WM_EXITMENULOOP StopTimer($Form1, $TIP_TIMER_ID) VoidMenuTip() EndSelect Return $GUI_RUNDEFMSG EndFunc ;==>MenuTipHandler Func _Exit() Exit EndFunc ;==>_Exit So long, Mega Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times Link to comment Share on other sites More sharing options...
evilertoaster Posted July 9, 2007 Share Posted July 9, 2007 mega, that example seems to be rather for making tooltips show on menu items. Although it does have a timer on them, i think the extra code is only nessacry for the menu item work around no? Link to comment Share on other sites More sharing options...
martin Posted July 9, 2007 Author Share Posted July 9, 2007 Hi,here is an example:Well, fancy meeting you here! Looks like you beat me to it.This method is more complicated than GuiCtrlSetTip but it is easier to control. I wish I'd thought of it. Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
martin Posted July 10, 2007 Author Share Posted July 10, 2007 (edited) I can't get the delay for GuiCTrlSetTip to work, so using the idea from eltorro here is a way for changing the time of a tooltip over a control. expandcollapse popup#include <guiconstants.au3> AdlibEnable("checktip",500) $main = GUICreate("Wtooltip") $but = GUICtrlCreateButton("exit",20,20,120,20) GUISetState() #region set tooltip bits Global $hbutton = GUICtrlGetHandle($but) Global $TDSET = False;the show timer has not been set Global $seenoverbut = False;mouse has been seen over button $butpos = ControlGetPos("Wtooltip","",$but) $windowpos = WinGetPos("Wtooltip") $c = WinGetClientSize("Wtooltip") $border = ($windowpos[2] - $c[0])/2;window border width $Titleht = $windowpos[3] - $c[1] - $border;window title height Global $xoffset = $butpos[0] + $butpos[2]/2 + $border;centre of button from edge of window Global $yoffset = +$butpos[1] + $butpos[3]/2 + $Titleht;from top of window Global $td = 0;timer Global $visibleTime = 8000;8 seconds #endregion set tooltip bits While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop WEnd Func checktip() If $TDSET Then If TimerDiff($td) > $visibleTime Then ToolTip("") EndIf If HWNDUnderMouse() = $hbutton Then If Not $seenoverbut Then $wp = WinGetPos("Wtooltip") ToolTip("over the button I see",$wp[0]+$xoffset,$wp[1] + $yoffset,"title",1,1) $td = TimerInit() $seenoverbut = True $TDSET = True EndIf Else If $seenoverbut Then $seenoverbut = False $TDSET =False ToolTip("") EndIf EndIf EndFunc Func HWNDUnderMouse() ;by Larry Local $point, $hwnd $point = MouseGetPos() If @error Then Return SetError(1,0,0) $hwnd = DLLCall("user32.dll", "hwnd", "WindowFromPoint", "int", $point[0], "int", $point[1]) If Not @error Or $hwnd[0] <> 0 Then Return $hwnd[0] Return SetError(2,0,0) EndFunc Edited July 10, 2007 by martin Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
drlava Posted September 17, 2007 Share Posted September 17, 2007 forget using timers and crap, here's a nice example function that allows you to set the display time of tooltips in your autoit GUI. it should be called after the entire GUI is created. it uses the TTM_SETDELAYTIME and TTDT_AUTOPOP native commands that you wanted to use, so it can be modified to allow setting of many tooltip parameters. #include <misc.au3> Func _TipDisplayLen($time=5000) Local $tiphandles, $i $tiphandles=WinList('[CLASS:tooltips_class32]') for $i=1 to $tiphandles[0][0] If WinGetProcess($tiphandles[$i][1]) = @AutoItPID Then _SendMessage($tiphandles[$i][1],0x0403,2,$time) Next EndFunc Link to comment Share on other sites More sharing options...
Valuater Posted September 17, 2007 Share Posted September 17, 2007 forget using timers and crap,here's a nice example function that allows you to set the display time of tooltips in your autoit GUI. it should be called after the entire GUI is created. it uses the TTM_SETDELAYTIME and TTDT_AUTOPOP native commands that you wanted to use, so it can be modified to allow setting of many tooltip parameters.of course you knew you were responding to a post from july 10thhere is a great demo for making a disply last while the mouse is over the control... using _ControlHover()http://www.autoitscript.com/forum/index.ph...st&p=402435Nice job too, by Dhilip8) Link to comment Share on other sites More sharing options...
martin Posted September 17, 2007 Author Share Posted September 17, 2007 forget using timers and crap, here's a nice example function that allows you to set the display time of tooltips in your autoit GUI. it should be called after the entire GUI is created. it uses the TTM_SETDELAYTIME and TTDT_AUTOPOP native commands that you wanted to use, so it can be modified to allow setting of many tooltip parameters. #include <misc.au3> Func _TipDisplayLen($time=5000) Local $tiphandles, $i $tiphandles=WinList('[CLASS:tooltips_class32]') for $i=1 to $tiphandles[0][0] If WinGetProcess($tiphandles[$i][1]) = @AutoItPID Then _SendMessage($tiphandles[$i][1],0x0403,2,$time) Next EndFunc That's good, thnaks for that, I should have looked up the messages for tooltips myself. You could have Const $TTM_SETDELAYTIME = $WM_USER + 3 instead of 0x0403 Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
drlava Posted September 17, 2007 Share Posted September 17, 2007 of course you knew you were responding to a post from july 10thhere is a great demo for making a disply last while the mouse is over the control... using _ControlHover()http://www.autoitscript.com/forum/index.ph...st&p=402435Nice job too, by Dhilip8)Yes, I knew it was old, but it's important to answer the question in the most direct way possible, for people when they search. I found this thread from a search, and there was no acceptable (to me) answer, thus the post. No one is going to find or want to wade through a table_of_the_elements script example when they search for tooltip set delay.. well, now they are Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now