Jump to content

ToolTipTimer UDF


ozmike
 Share

Recommended Posts

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
Link to comment
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.

Link to comment
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..

Link to comment
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.

Link to comment
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

Link to comment
Share on other sites

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
Link to comment
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

Link to comment
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

Link to comment
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

Link to comment
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

Link to comment
Share on other sites

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
Link to comment
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

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...