olympus Posted November 21, 2009 Share Posted November 21, 2009 Anyone knows how to change the delay before and during the display of the tool tip? For example the tip should only appear after 2 secs when the mouse pointer hovers over control(button, text, etc) and only disappears after 5 seconds. I did a search and found this example: http://www.autoitscript.com/forum/index.php?showtopic=53237 How do I apply it and will it work for the delay before the tool tip appears? Thank you! Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted November 21, 2009 Moderators Share Posted November 21, 2009 olympus,This works, but it is not pretty: expandcollapse popup#include <GUIConstantsEx.au3> $hGUI = GUICreate("Test", 500, 500) $hButton = GUICtrlCreateButton("Tip Test", 10, 10, 200, 30) GUISetState() $iBegin = 0 $fTip = False While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch ; See if cursor is over button $aInfo = GUIGetCursorInfo($hGUI) If $aInfo[4] = $hButton Then ; Run this while cursor is over button Do $aInfo = GUIGetCursorInfo($hGUI) If $iBegin = 0 Then $iBegin = TimerInit() If TimerDiff($iBegin) > 4000 And $fTip = False Then ; <<<<<<<<< wait 5 secs before displaying (it takes 1 sec for the tip to display) GUICtrlSetTip($hButton, "Test", "Tip") $fTip = True EndIf If TimerDiff($iBegin) > 10000 And $fTip = True Then ExitLoop ; <<<<<< Stop after 10 secs Until $aInfo[4] <> $hButton EndIf ; If the cursor leaves the button or if timed out If $fTip = True Then GUICtrlSetTip($hButton, "") $fTip = False $iBegin = 0 WEndYou can easily adjust the timing in the TimerDiff commands to suit your needs.I hope it helps.M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
olympus Posted November 21, 2009 Author Share Posted November 21, 2009 olympus, This works, but it is not pretty: expandcollapse popup#include <GUIConstantsEx.au3> $hGUI = GUICreate("Test", 500, 500) $hButton = GUICtrlCreateButton("Tip Test", 10, 10, 200, 30) GUISetState() $iBegin = 0 $fTip = False While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch ; See if cursor is over button $aInfo = GUIGetCursorInfo($hGUI) If $aInfo[4] = $hButton Then ; Run this while cursor is over button Do $aInfo = GUIGetCursorInfo($hGUI) If $iBegin = 0 Then $iBegin = TimerInit() If TimerDiff($iBegin) > 4000 And $fTip = False Then ; <<<<<<<<< wait 5 secs before displaying (it takes 1 sec for the tip to display) GUICtrlSetTip($hButton, "Test", "Tip") $fTip = True EndIf If TimerDiff($iBegin) > 10000 And $fTip = True Then ExitLoop ; <<<<<< Stop after 10 secs Until $aInfo[4] <> $hButton EndIf ; If the cursor leaves the button or if timed out If $fTip = True Then GUICtrlSetTip($hButton, "") $fTip = False $iBegin = 0 WEnd You can easily adjust the timing in the TimerDiff commands to suit your needs. I hope it helps. M23 I tried your example and it doesn't seem to work... I added ' $fTip = GUICtrlSetTip(-1, "test", "test") ' before ' GUISetState()' and your tip appeared after my tip but the delay was the same. Without the added line, your tip wouldn't appear, I'm not sure why. Will the AutoIt team add a parameter to GUICtrlSetTip in the future to adjust the delay? I'm sure most users would appreciate it. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted November 21, 2009 Moderators Share Posted November 21, 2009 olympus, Sorry it did not work for you - works beautifully for me. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area 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