Jump to content

Recommended Posts

Posted

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!

  • Moderators
Posted

olympus,

This works, but it is not pretty: :)

#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

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Posted

olympus,

This works, but it is not pretty: ;)

#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. :)

  • Moderators
Posted

olympus,

Sorry it did not work for you - works beautifully for me. :)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...