Sign in to follow this  
Followers 0
MyEarth

Tooltip coordinate position

7 posts in this topic

When do you create a Tooltip, the x position and the y position are relative to entire screen. Is possible instead to make them relative to the GUI? Like when you create a control

Pratically i want to position a tooltip under a control so if the control is a 10px on y the tooltip is under 10px+height of the control

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

You can get the control position (relative to the screen) with WinGetpos by using the control handle :

#Include <Array.au3>

Run("calc")
WinWait("[CLASS:CalcFrame]")
Local $hControl = ControlGetHandle("[CLASS:CalcFrame]","", "[CLASS:Button; INSTANCE:1]")
Local $aPos = WinGetPos($hControl)

_Arraydisplay($aPos)

So you just have to use these coordinates with ToolTip :

Run("calc")
WinWait("[CLASS:CalcFrame]")


For $i = 1 To 10
    Local $hControl = ControlGetHandle("[CLASS:CalcFrame]","", "[CLASS:Button; INSTANCE:" & $i & "]")
    Local $aPos = WinGetPos($hcontrol) ; Left   = $aPos[0] 
                                 ; Top    = $aPos[1]
                                 ; Width  = $aPos[2]
                                 ; Height = $aPos[3]

    ToolTip("tooltip under control", $aPos[0], $aPos[1] + $aPos[3])
    Sleep(500)
Next
Edited by jguinch

Share this post


Link to post
Share on other sites

You might also consider ControlGetPos.

Share this post


Link to post
Share on other sites

Are you creating a tooltip for a GUI you're building or a non-AutoIt GUI?


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

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

An Autoit GUI, if wasn't different i would have written at my first post. I have try some AutoItSetOption but nothing change for ToolTip, the idea of calculate the position is good but is the only one? Searching again i have found an old post of 2006 and is pratically the same idea posted by jguinch:

Edited by MyEarth

Share this post


Link to post
Share on other sites

I'm with jguinch on this one, which is why I asked about the GUI above, there's already a command to do what you want to do. Or if you want something fancier there's the GUIToolTip UDF to work with.


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

Share this post


Link to post
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
Sign in to follow this  
Followers 0