Jump to content

GUIToolTip UDF rewrite


BrewManNH
 Share

Recommended Posts

That might work, although I can't understand why it doesn't work as it used to. Maybe I got lucky before and was leaving the mouse pointer there when I first wrote the example. It's been a while so I forget things as I get older. 

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

  • 4 months later...

BrewManNH,

 

It works if I do that. :thumbsup:

Perhaps change the button text like this? :huh:

#include <GUIConstantsEx.au3>
#include <GUIToolTip.au3>

Example()

Func Example()
    Local $hGUI = GUICreate(StringTrimRight(@ScriptName, 4), 350, 200)

    Local $iButton = GUICtrlCreateButton("ToolTip showing", 30, 32, 130, 28)
    Local $hButton = GUICtrlGetHandle($iButton)

    Local $hToolTip = _GUIToolTip_Create($hGUI, BitOR($_TT_ghTTDefaultStyle, $TTS_BALLOON))
    _GUIToolTip_AddTool($hToolTip, 0, " ", $hButton)
    GUISetState()

    _GUIToolTip_TrackActivate($hToolTip, True, 0, $hButton)
    Local $Msg, $Display = True
    $hTimer = TimerInit()
    While 1
        Sleep(10)
        Local $aMousePos = MouseGetPos()
        _GUIToolTip_TrackPosition($hToolTip, $aMousePos[0] + 10, $aMousePos[1] + 20)
        _GUIToolTip_UpdateTipText($hToolTip, 0, $hButton, "X: " & $aMousePos[0] & " Y: " & $aMousePos[1])
        $Msg = GUIGetMsg()
        Switch $Msg
            Case $GUI_EVENT_CLOSE
                ExitLoop
        EndSwitch
        ; Every 8 seconds the tooltip will be "popped" in or out of view
        ; to get it to display after the 8 seconds has passed, you have to hover
        ; over the button.
        If TimerDiff($hTimer) > 8000 Then
            $Display = Not $Display
            $hTimer = TimerInit()
            If $Display Then
                GUICtrlSetData($iButton, "ToolTip showing")
                $iRet = _GUIToolTip_PopUp($hToolTip)
                ConsoleWrite($iRet & @CRLF)
            Else
                GUICtrlSetData($iButton, "Hover here now")
                _GUIToolTip_Pop($hToolTip)
            EndIf
        EndIf
    WEnd
    ; Destroy the tooltip control
    _GUIToolTip_Destroy($hToolTip)
    GUIDelete($hGUI)
EndFunc   ;==>Example
M23

It doesn't work 100%, maybe 50% at most. Button might show "Tooltip showing", but no tooltip actually showing.

Is this UDF now the official that comes with AU3 v3.3.10.2 ?

Link to comment
Share on other sites

The GUIToolTip UDF that is included with the latest version of AutoIt is the rewrite.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

Yes it does, at least if you follow the directions. It's not the best example of using _GUIToolTip_PopUp as it assumes the user can read the instructions, but it works. If you would like to create your own example for it that works better feel free. Personally, I think the function itself is kind of pointless because it's functionality can be done much easier with other functions in the UDF. 

Some of the functions in the UDF don't work as I expected them to, and that is why they have no example scripts because I couldn't get them to work. I didn't remove them because they may actually work, and I am just not using them correctly because I don't get the underlying usage.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

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
 Share

×
×
  • Create New...