Sign in to follow this  
Followers 0
icuurd12b42

Show multiple tips at the same time help!

11 posts in this topic

#1 ·  Posted (edited)

Right so I'm trying to have a bunch of tool tips appear on the screen, mainly to display entry error in input boxes when you hit a button.

func OnOK()

if(GetUserName() = "" ) then ShowTimedTip(ctrl_UserDD,1000,"Input Error", "User name is invalid",$TTI_ERROR)

if(GetDestName() = "" ) then ShowTimedTip(ctrl_DestDD,1000,"Input Error","Destination name is invalid",$TTI_ERROR)

if(GetMessage() = "" ) then ShowTimedTip(ctrl_MsgTB,1000,"Input Error","Please type a message",$TTI_ERROR)

endfunc

The problem is the ToolTip wont allow multiple tips

with GUICtrlSetTip() you CANNOT trigger the tip to show...

I added stub EditBoxes because I can trigger the tip of edit boxes

$_POP_HWND[$_POP_AT] =GUICtrlCreateEdit("",$lx,$ly,0,0)

GUICtrlSetTip($_POP_HWND[$_POP_AT], $message,$title,$icon,1);

_WinAPI_ShowWindow(GUICtrlGetHandle($_POP_HWND[$_POP_AT]),@SW_HIDE)

_GUICtrlEdit_ShowBalloonTip(GUICtrlGetHandle($_POP_HWND[$_POP_AT]), $title,$message,$icon)

However it's useless because this tip TOO can only be a singleton. If I show one tip, it nukes the previous at the other location

Finally I went and tried every example involving _CreateToolTip on the site and absolutely none of them work so I cant tell if I can show more than one. I assume you could if you call _CreateToolTip multiple times, that would create a tip window dedicated to a single control box

this is the result test code

func onclick()

;create stub ctrl, set the tip to it, and show the tip

Global $idstub = GUICtrlCreateLabel("Stub", 50, 150, 120, 22)

Global $hstub = GUICtrlGetHandle($idstub)

Global $hTip = _GUIToolTip_Create($hMainWnd,BitOR($TTS_ALWAYSTIP,$TTS_BALLOON))

_GUIToolTip_AddTool($hTip, $hstub, "Button Two: This is the tooltip for Button2")

_GUIToolTip_SetTitle($hstub,"Title",3)

_GUIToolTip_Activate($hTip)

endfunc

but it's a dud like all the site sample codes I found on the forum. I must be doing something wrong...

Has anyone ever been able to show multiple tool tips at the same time?

I would like a function like

ShowTimedTip($ctrl,$time_ms,$title,$text,$icon)

that would create a non blocking, non replacing tip on screen which would self destruct after the time elapsed. I can handle the timed self destruct but I really need help on getting that darn _GUIToolTip to work.

Edited by icuurd12b42

Share this post


Link to post
Share on other sites



Autoit is single threaded therefore multilple tooltips cannot be shown asynchrounously

you could try to do this by

  • creating a script that would create a temporary script having the tooltip functions
  • using the switch /AutoIt3ExecuteScriptFile and execute the file just created

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

That's not the reason...

Actually, a tool tip is a window like everything you see in windows, your GUI, your controls.... You can have as many as you want.

In fact AutoIT has 3 tool tip windows active, one for ToolTip(), one for GUICtrlSetTip() and one for _GUICtrlEdit_ShowBalloonTip()

All of those can be up at the same time. A tool tip window can manage many controls or you can have one tip window per control. in this case they could co-exists, just like all 3 pre-canned tool tips can co exist. I proper fix would be to go the _WinApi way to create multiple tool tip windows and control their text and existence individually. There are a few example code on the site but none of them work

Anyway, the worst thing about ToolTip is it goes on top of everything instead of on top the window that called it. Meaning you get nasty messages from an application you are not using while in Word for example and that confuses the user.

See my tooltip replacement

Launching another app is a bad idea. You get UAC window popping or the dreaded "This publisher cannot be verified" message. I can deal with that message launching the app, but not every time I need to pop up a tip to the user.

Share this post


Link to post
Share on other sites

You should look at the _GUIToolTip functions, you can have as many tooltips as you need, and you can put them anywhere on the screen, color them, change the font, etc.


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

Launching another app is a bad idea. You get UAC window popping or the dreaded "This publisher cannot be verified" message. I can deal with that message launching the app, but not every time I need to pop up a tip to the user.

Actually you don't need to run as admin just to show a tooltip, so you're doing something weird there. But I agree that launching multiple apps is not good either.

Share this post


Link to post
Share on other sites

You should look at the _GUIToolTip functions, you can have as many tooltips as you need, and you can put them anywhere on the screen, color them, change the font, etc.

Like the code in the onclick function in the main post? Yeah, that does not work. Any idea why?

Actually you don't need to run as admin just to show a tooltip, so you're doing something weird there. But I agree that launching multiple apps is not good either.

Never said you need to run as admin to show a ToolTip in the gui, just that the idea to bypass the problem via launching an app was not reasonable.

Can't you just insert data into a editbox or label and just use it as a tip?

http://www.youtube.com/watch?v=GN2U8J4fqPg&feature=youtu.be

Yep, I actually had that code too, not working as well as your video though, the label often got clipped, half drawn. Did you have to add extra flags to the label window?

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

You should just need to make sure the label has a bounding width and height, the editbox in readonly mode is very nice for extended tooltips.

example:

$control[$controls][0]= guictrlcreateedit($controldata[2], $controldata[3], $controldata[4], $controldata[5], $controldata[6], $WS_VSCROLL)
if $controldata[10]= 1 then guictrlsendmsg($controls][0], $EM_SETREADONLY, 1, 0);read-only

Sorry about the variables, you can make it all out with the help file.

I use $control[$controls][1] to store extended tooltips.

Edited by Xandy

I am not a lawyer.  (-_-) Xandy About  (^o^) Discord - Xandy Programmer

Share this post


Link to post
Share on other sites

Never said you need to run as admin to show a ToolTip in the gui, just that the idea to bypass the problem via launching an app was not reasonable.

Sure you did. If you don't run as admin then you shouldn't see any UAC popup.

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

another example:

;create tip control
$tooltipcontrol= guictrlcreateedit("", 5, 5, 200, 80, $WS_VSCROLL)
;somewhere in your loop. detect control mouse over.
$a= guigetcursorinfo($win);$win is your gui handle
if isarray($a) then;check for control under mouse.
    if $a[2]= 1 then
        ;you could include a mouse button down check
        for $i= 0 to $controlmax-1
            if $control[$i][0]= $a[4] then
                guictrlsetdata($tooltipcontrol, $control[$i][1])
                exitloop
            endif
        next
    endif
endif

but you'd have to make sure you can check a list of controls.

and I kind-of threw it together, I hope it can help.

Edited by Xandy

I am not a lawyer.  (-_-) Xandy About  (^o^) Discord - Xandy Programmer

Share this post


Link to post
Share on other sites

Sure you did. If you don't run as admin then you shouldn't see any UAC popup.

Where? Where did I say you need to run as admin to show a tool tip? Where? Quote me! Are you trying to play with my head here? ;)

another example:

;create tip control
$tooltipcontrol= guictrlcreateedit("", 5, 5, 200, 80, $WS_VSCROLL)
;somewhere in your loop. detect control mouse over.
$a= guigetcursorinfo($win);$win is your gui handle
if isarray($a) then;check for control under mouse.
    if $a[2]= 1 then
;you could include a mouse button down check
        for $i= 0 to $controlmax-1
            if $control[$i][0]= $a[4] then
                guictrlsetdata($tooltipcontrol, $control[$i][1])
                exitloop
            endif
        next
    endif
endif

but you'd have to make sure you can check a list of controls.

and I kind-of threw it together, I hope it can help.

Thanks,

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