Sign in to follow this  
Followers 0
ozmike

ToolTipTimer UDF

14 posts in this topic

#1 ·  Posted (edited)

Hi

I've create this udf so that you can display, tool tips, for a certain amount of time asyncronously?



So it works like tray tips.

Normally you go
 

tooltips("blah")
sleep(3000); 3 secs

This works ok but, but halts program while sleeping, this UDF , let you do other things
as soon as the tool tip is displayed. Useful when intercepting mouse events.

tooltipstimer("blah", 3000)
;do something straight away

enjoy

With PhoenixXL's suggested code
tooltiptimer v2.zip

my original code
TooltipTimer.zip

Edited by ozmike

Share this post


Link to post
Share on other sites



Maybe you have complicated your Function

it could be simplified as follows

; Display a tool tip for an arbitary amount of time without the need of a sleep() and tooltip("")
; Adds a timeout parameter to tooltips like tray tips have.
; Useful when dislaying a tooltip when you don't want to halt the program eg. when handling
; Mouse events
;
; returns - the same as tooltip()
;
; see example
Func _ToolTipTimer($sTooltipText, $iTimer, $x = Default, $y = Default, $title = Default, $icon = Default, $options = Default)

Local $iRet = ToolTip($sTooltipText, $x, $y, $title, $icon, $options);

AdlibRegister("_ToolTipTimer_Blank", $iTimer) ; create timer

Return $iRet

EndFunc   ;==>_ToolTipTimer

Func _ToolTipTimer_Blank( )

ToolTip('')

AdlibUnRegister("_ToolTipTimer_Blank")

EndFunc   ;==>_ToolTipTimer_Blank

My code:

PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.

Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners.

MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. 

Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.

Share this post


Link to post
Share on other sites

Thanks phoenixXL

I couldn't figure out how to use 'default'...parameters

btw ..Why use AdLibRegister ?...is that just a low level call?

thanks for your suggestion..i might incorporate your code

its a simple udf ..i'll admit..

Share this post


Link to post
Share on other sites

_Timer_SetTimer function is used to assign a number of timers and kill them variably and hence it takes a bit of time more that AdLibRegister

But in this case

only one tooltip could be assigned once so AdlibRegister would prove more efficient


My code:

PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.

Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners.

MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. 

Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

Thanks again

PhoenixXL

- i'll credit you when i get around to the next version...

Edited by ozmike

Share this post


Link to post
Share on other sites

Why not just use the _GUIToolTip udf tooltips, and then you can set the time to whatever you'd like with one line?

_GUIToolTip_SetDelayTime($hWnd, $iDuration, $iTime)

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

#8 ·  Posted (edited)

Hi

The autoit tooltip command by default just displays at the mouse pointer (not bound to a GUI or control).

I'm not familiar GuiToolTip.au3 .how would you display a tool tip using this udf at the current mouse pointer?

Edited by ozmike

Share this post


Link to post
Share on other sites

Look at the demo I have linked in my signature. There are more code examples that Azjio posted that will give you more information on how to use them.


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

Hi the GUItooltipUDF demo is pretty good..like the colors..

But the demo it in its current form only works for the GUI (current ) window..eg..

"This is a tooltip for the whole GUI"

the autoit tooltip() command is not linked to a GUI and only requires one line of code !

so thats one advantage! Also if you are blocking mouse clicks you might want to display a tool tip

at the mouse pointer in any window..not just a particular window..

maybe the help file example that azjio have added might explain how to do a free floating anywhere tooltip..

how do i get this help file?

thanks again

Share this post


Link to post
Share on other sites

maybe the help file example that azjio have added might explain how to do a free floating anywhere tooltip..

how do i get this help file?

thanks again


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

Follow up, I found from PsaltyDS that shows how to position a UDF created tooltip without tying it to a control.


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

#13 ·  Posted (edited)

Hi

Had a play with the that script, does indeed display at the mouse pointer

but calling this should display for one second?

_GUIToolTip_SetDelayTime(0, 0, 1000)

the help file suggests that _GUIToolTip_SetDelayTime suggests its for moving pointer and controls

maybe _GUIToolTip UDF is need a set 'display time' rather than a DelayTime?

The below code should i think display a tool tip for 1 sec but displays for 5 secs.

_GUIToolTip_SetDelayTime(0, 0, 1000)
Global $hToolTip4 = _GUIToolTip_CreateToolTip(0, "", "ToolTip 4", 0, _
@DesktopWidth / 2, @DesktopHeight / 2 + 130, 32 + 16)
Local $aPos = MouseGetPos()

_GUIToolTip_TrackPosition($hToolTip4, $aPos[0]+10, $aPos[1]+20)
_GUIToolTip_UpdateTipText($hToolTip4, 0, 0, "X: " & $aPos[0] & " Y: "&$aPos[1])
sleep(5000);
exit;
Edited by ozmike

Share this post


Link to post
Share on other sites

The help file doesn't say anything about the function moving the mouse pointer in there. It says that the 1 value sets the time it takes for the pointer to appear as you move the mouse from one control to another.

Your delay time setting will make it so that the tooltip won't appear for 1 second, will stay visible for 10 seconds and then you won't be able to display a new tooltip for 1/5th of a second.

The help file is missing a LOT of information in regards to tooltips for that UDF. I got this from the MSDN site in regards to what the settings do.

TTDT_AUTOMATIC (0)

Set all three delay times to default proportions. The autopop time will be ten times the initial time and the reshow time will be one fifth the initial time. If this flag is set, use a positive value of lParam to specify the initial time, in milliseconds. Set lParam to a negative value to return all three delay times to their default values.


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

  • Similar Content

    • CygnusX1
      By CygnusX1
      Hello, AutoIt People!
      I've about pulled out my hair trying to capture the text of tooltips from an application not created from AutoIt.  I have looked at all the documentation, Google searches, endless tries, failures across the board. 
      I've tried...
      WinActivate($sTitle) MouseMove(512, 224, 1) ;over the control Sleep(3000) ;display tooltip $hWnd = ControlGetHandle($sTitle, "", 2502) ConsoleWrite(_GUIToolTip_ToolExists($hWnd) & @lf) ;comes back false $hTool = WinGetHandle($sTitle) ;handle of window containing control ; how do you get the $iID $arr = _GUIToolTip_GetToolInfo($hWnd, $hTool, $iID) ;$iID How do you get the Identifier of the tool?
      I'm at a complete loss. 
      Thank you.
    • martin
      By martin
      Maximized Windows in Windows 10 usually (for me) don't show tooltips or hints.  For a short time following a WIndows update this was fixed on my laptop but after another day, and maybe another update, the problem returned, so I don't understand what the conditions are.
      The script below checks for maximized windows and sets their size to a few pixels less than the screen size and this brings back tooltips.
      I have found another way to fix the problem which might help some people. There are several programs I use regularly and the tooltips are important. On the programs I compile the tooltips help my users if they are not familiar with using the programs. If I set the maximum window size to be greater than the screen size ( @DesktopHeight/@Desktopwidth) then when maximized it still fits the screen ok but the tooltips still work. This can be done in AUtoIt with
      GUIRegisterMsg($WM_GETMINMAXINFO, "MY_WM_GETMINMAXINFO")---- (search for examples)
      In Delphi it can be done with Form.Constraints. I don't know about other languages.
      For apps where the maximum size  can't be controlled the script below could help someone; it helps me at least.
      Const $SPI_SETWORKAREA = 47, $SPI_GETWORKAREA = 48, $SPIF_SENDCHANGE = 11 $StartRect = DllStructCreate("int[4]") $PStartRect = DllStructGetPtr($StartRect) $res = DllCall("user32.dll", "int", "SystemParametersInfo", "int", $SPI_GETWORKAREA, "int", 0, "ptr", $PStartRect, "int", 0) $maxwid = DllStructGetData($StartRect, 1, 3) - DllStructGetData($StartRect, 1, 1) $maxht = DllStructGetData($StartRect, 1, 4) - DllStructGetData($StartRect, 1, 2) While 1 $aList = WinList() $res = DllCall("user32.dll", "int", "SystemParametersInfo", "int", $SPI_GETWORKAREA, "int", 0, "ptr", $PStartRect, "int", 0) $maxwid = DllStructGetData($StartRect, 1, 3) - DllStructGetData($StartRect, 1, 1) $maxht = DllStructGetData($StartRect, 1, 4) - DllStructGetData($StartRect, 1, 2) For $i = 1 To $aList[0][0] If $aList[$i][0] <> 'Program Manager' Then $ws = WinGetPos($aList[$i][1]) if isarray($ws) then;for some reason it isn't always If $aList[$i][0] <> "" And $ws[2] > $maxwid And $ws[3] > $maxht Then WinSetState($aList[$i][1], '', @SW_RESTORE);because changing the size leaves it as maximised as far as Windows is concerned! WinMove($aList[$i][1], '', $ws[0],$ws[1], $maxwid, $maxht) Endif EndIf EndIf Next Sleep(5000) WEnd  
      25th January 2016. WIndows 10 had a major update overnight on my PC.  Now the problem with missing tooltips has gone. I din't know Microsoft studied these forums so carefully. So this means this script is no longer needed by me or anyone else.
      24 Jan 2016 Edit again after Argumentum pointed out more than one monitor not allowed for. Not certain this is still correct but will test it with another monitor during next few days.
      24th Jan 2016 Improved to use working area of desktop because the Taskbar  and other apps can use up some of the desktop, so a maximised window is not necessarily to desktop size. (I tried testing for @Maximized but it failed, and I didn't spend any time worying about why though it would be better.)