Jump to content

Dynamic Tooltip Example


Recommended Posts

I borrowed some code from the 'GUICtrlCreatePic Example' in the help file to illustrate a problem I am having using the Tooltip function.

When the following script is running, the arrow keys will move Merlin around the screen.

I want the tooltip to show his coordinates for a second and then disappear.

This tooltip example fails to disappear.

I am hoping this is a logic problem on my part, but I don't see how.

Thanks for any suggestions.

taurus905

; Dynamic Tooltip Example.au3
#include "GUIConstants.au3"

$gui=GUICreate("Dynamic Tooltip Example", 200, 100)
$pic=GUICreate("", 68, 71, 10, 10,$WS_POPUP,BitOr($WS_EX_LAYERED,$WS_EX_MDICHILD),$gui)
GUICtrlCreatePic(@Systemdir & "\oobe\images\merlin.gif",0,0, 0,0)

GUISetState(@SW_SHOW,$pic)
GUISetState(@SW_SHOW,$gui)

HotKeySet("{LEFT}", "left"); Press left arrow key to move Merlin
HotKeySet("{RIGHT}", "right"); Press right arrow key to move Merlin
HotKeySet("{DOWN}", "down"); Press down arrow key to move Merlin
HotKeySet("{UP}", "up"); Press up arrow key to move Merlin
$picPos = WinGetPos($pic)

While 1
    $msg = GUIGetMsg()
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
WEnd
Exit

Func left ()
    $picPos = WinGetPos($pic)
    WinMove($pic,"",$picPos[0]-10,$picPos[1])
    ToolTip("x=" & $picPos[0] & "  y=" & $picPos[1], $picPos[0], $picPos[1])
EndFunc

Func right()
    $picPos = WinGetPos($pic)
    WinMove($pic,"",$picPos[0]+10,$picPos[1])
    ToolTip("x=" & $picPos[0] & "  y=" & $picPos[1], $picPos[0], $picPos[1])
EndFunc

Func down()
    $picPos = WinGetPos($pic)
    WinMove($pic,"",$picPos[0],$picPos[1]+10)
    ToolTip("x=" & $picPos[0] & "  y=" & $picPos[1], $picPos[0], $picPos[1])
EndFunc

Func up()
    $picPos = WinGetPos($pic)
    WinMove($pic,"",$picPos[0],$picPos[1]-10)
    ToolTip("x=" & $picPos[0] & "  y=" & $picPos[1], $picPos[0], $picPos[1])
EndFunc

"Never mistake kindness for weakness."-- Author Unknown --"The highest point to which a weak but experienced mind can rise is detecting the weakness of better men."-- Georg Lichtenberg --Simple Obfuscator (Beta not needed.), Random names for Vars and Funcs

Link to comment
Share on other sites

You need to tell the tooltip exactly when to disappear with the

ToolTip("") command

hmm, maybe AdlibEnable?

Manadar,

I could have sworn I tried that earlier! :D

Thank you for making me try it again.

It worked this time. :D

taurus905

"Never mistake kindness for weakness."-- Author Unknown --"The highest point to which a weak but experienced mind can rise is detecting the weakness of better men."-- Georg Lichtenberg --Simple Obfuscator (Beta not needed.), Random names for Vars and Funcs

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

  • Recently Browsing   0 members

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