Jump to content

Recommended Posts

Posted

well, to be fair the win8 part is based on nothing - I doubt we even had dark mode back then... but yep, certainly it could just be a busted func. Especially if the others work as expected.

Posted (edited)

trick for ToolTip with timer

Func _ToolTip($sText, $iX = Default, $iY = Default, $sTitle = "", $iIcon = 0, $iTimeout = 1500, $iOptions = 0)
    AdlibUnRegister("_ToolTipKiller") ; This prevents the previous timer from closing the new tooltip.
    ToolTip($sText, $iX, $iY, $sTitle, $iIcon, $iOptions)
    AdlibRegister("_ToolTipKiller", $iTimeout)
EndFunc   ;==>_ToolTip

Func _ToolTipKiller()
    ToolTip("") ; Hide the tooltip
    AdlibUnRegister("_ToolTipKiller") ; unregister itself.
EndFunc   ;==>_ToolTipKiller

Example

; https://www.autoitscript.com/forum/topic/139260-autoit-snippets/page/28/#findComment-1546696
;----------------------------------------------------------------------------------------
; Title...........: Trick for ToolTip with timer
; Description.....: Displays a native tooltip with timer.
; AutoIt Version..: 3.3.16.1   Author: ioa747  Script Version: 0.1
; Note............: Testet in Win10 22H2       Date:16/10/2025
;----------------------------------------------------------------------------------------
#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7
#include <GUIConstantsEx.au3>

Forms()

Func Forms()
    Local $hGui = GUICreate(@ScriptName, 250, 150, -1, -1)
    Local $idBtn1 = GUICtrlCreateButton("Button 1", 10, 10, 100, 25)
    Local $idBtn2 = GUICtrlCreateButton("Button 2", 10, 40, 100, 25)
    Local $idBtn3 = GUICtrlCreateButton("Button 3", 10, 70, 100, 25)
    Local $idBtn4 = GUICtrlCreateButton("Button 4", 10, 100, 100, 25)
    GUISetState(@SW_SHOW, $hGui)

    While 1
        Local $aWPos = WinGetPos($hGui)
        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE
                ExitLoop
            Case $idBtn1
                _ToolTip("...is clicked", $aWPos[0], $aWPos[1] - 15, "Button 1", 1)
            Case $idBtn2
                _ToolTip("...is clicked", $aWPos[0], $aWPos[1] - 15, "Button 2", 1)
            Case $idBtn3
                _ToolTip("...is clicked", $aWPos[0], $aWPos[1] - 15, "Button 3", 1)
            Case $idBtn4
                _ToolTip("...is clicked", $aWPos[0], $aWPos[1] - 15, "Button 4", 1)
        EndSwitch
    WEnd
    GUIDelete($hGui)
EndFunc   ;==>Forms


Func _ToolTip($sText, $iX = Default, $iY = Default, $sTitle = "", $iIcon = 0, $iTimeout = 1500, $iOptions = 0)
    AdlibUnRegister("_ToolTipKiller") ; This prevents the previous timer from closing the new tooltip.
    ToolTip($sText, $iX, $iY, $sTitle, $iIcon, $iOptions)
    AdlibRegister("_ToolTipKiller", $iTimeout)
EndFunc   ;==>_ToolTip

Func _ToolTipKiller()
    ToolTip("") ; Hide the tooltip
    AdlibUnRegister("_ToolTipKiller") ; unregister itself.
EndFunc   ;==>_ToolTipKiller

 

Edited by ioa747
prettify

I know that I know nothing

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...