help(wparam, lparam, msg) { mousegetpos, , , win, control wingettitle, title, ahk_id %win% global folder if (title = "mittere") { if (control = "button2") { description := "Select application" } else if (control = "button3") { description := "Select folder" } else if (control = "button4") { description := "Add selection" } else if (control = "button5") { description := "Add Mittere to the`nSend To menu" } else if (control = "button6") { description := "Open the Send To`nfolder in Explorer" } else if (control = "button7") { description := "Done" } } else if instr(title, "options for") { if (folder = 1) { if (control = "button2") { description := "Set name`nto default" } else if (control = "button3") { description := "Skip item" } else if (control = "button4") { description := "Submit" } } else { if (control = "button2") { description := "Select a starting directory" } else if (control = "button3") { description := "Set all fields to`ndefault values" } else if (control = "button4") { description := "Skip item" } else if (control = "button5") { description := "Submit" } } } tooltip, %description% } returnThanks for any help. :?
(SOLVED) OnMessage gui tooltips issues
~Albert Campion
-----------------------------------------------------------------------------------------------
Website | Demo scripts | Blog | External contact
I solved the tooltip problem adding
Tooltip
right after Gui, Show
of each new window, don't know why it's not working for you.As for the delay and time adjustments, this example from the Gui help page worked fine for me:
; Example: Display context-senstive help (via ToolTip) whenever the user moves the mouse over a particular control: Gui, Add, Edit, vMyEdit MyEdit_TT := "This is a tooltip for the control whose variable is MyEdit." Gui, Add, DropDownList, vMyDDL, Red|Green|Blue MyDDL_TT := "Choose a color from the drop-down list." Gui, Add, Checkbox, vMyCheck, This control has no tooltip. Gui, Show OnMessage(0x200, "WM_MOUSEMOVE") return WM_MOUSEMOVE() { static CurrControl, PrevControl, _TT ; _TT is kept blank for use by the ToolTip command below. CurrControl := A_GuiControl If (CurrControl <> PrevControl and not InStr(CurrControl, " ")) { ToolTip ; Turn off any previous tooltip. SetTimer, DisplayToolTip, 1000 PrevControl := CurrControl } return DisplayToolTip: SetTimer, DisplayToolTip, Off ToolTip % %CurrControl%_TT ; The leading percent sign tell it to use an expression. SetTimer, RemoveToolTip, 3000 return RemoveToolTip: SetTimer, RemoveToolTip, Off ToolTip return } GuiClose: ExitApp
Rodolfo U. Batista
Pulover's Macro Creator - Automation Tool (Recorder & Script Writer) | Class_LV_Rows - Copy, Cut, Paste and Drag ListViews | Class_Toolbar - Create and modify | Class_Rebar - Adjustable GUI controls
Join the New AutoHotkey Forum!
Hmmm... Since you got it to work I will keep fiddling with it and see what comes.I solved the tooltip problem adding Tooltip right after Gui, Show of each new window, don't know why it's not working for you.
Yes, it appears to work much better than my current method! I will see if it can be adapted to my more complicated script. Thank you again Pulover. You are a positive oracle of scripting wisdom.As for the delay and time adjustments, this example from the Gui help page worked fine for me:
~Albert Campion
-----------------------------------------------------------------------------------------------
Website | Demo scripts | Blog | External contact
:lol:Thank you again Pulover. You are a positive oracle of scripting wisdom.
You made me laugh now, dmg... I don't have such a large experience scripting but I like to help whenever I can.
Count on me when you need!
Rodolfo U. Batista
Pulover's Macro Creator - Automation Tool (Recorder & Script Writer) | Class_LV_Rows - Copy, Cut, Paste and Drag ListViews | Class_Toolbar - Create and modify | Class_Rebar - Adjustable GUI controls
Join the New AutoHotkey Forum!
The line
CurrControl := A_GuiControl
indicates that A_GuiControl
contains the var name of the control under the cursor, but I don't see anything in the script to show how it knows which control it is. Normally something like MouseGetPos would be needed, and the A_GuiControl
description in the docs is not very helpful.The line
If (CurrControl <> PrevControl and not InStr(CurrControl, " "))
prevents the tooltip from activating more than once while hovering over a single control, but why does it check for spaces?I think it is a little like feeding stray animals... You answer some of my questions and I keep coming back to ask more. It never ends! :lol:
~Albert Campion
-----------------------------------------------------------------------------------------------
Website | Demo scripts | Blog | External contact
When I started using this example I didn't understand half of it... So this is the first time I actually try. ^^
but I don't see anything in the script to show how it knows which control it is.
A_GuiControl
is launched with every mouse movement, so for what I could understand OnMessage
thread is launched by the gui and therefore the variable contains the control that launched it. Besides I wouldn't be surprised if MouseGetPos
internally used the same 0x200 message.I think this was supposed to check if the control has no associated variable (because variable names does not accept spaces) thus avoiding showing an error message, but it doesn't work for some reason. The documentation says:but why does it check for spaces?
So if there's no variable it shows the text, and if the text has a space it should not show the tooltip but I still get an error message... Strange.If that control lacks an associated variable, A_GuiControl instead contains the first 63 characters of the control's text/caption
Rodolfo U. Batista
Pulover's Macro Creator - Automation Tool (Recorder & Script Writer) | Class_LV_Rows - Copy, Cut, Paste and Drag ListViews | Class_Toolbar - Create and modify | Class_Rebar - Adjustable GUI controls
Join the New AutoHotkey Forum!
OK. That makes sense.I think this was supposed to check if the control has no associated variable (because variable names does not accept spaces) thus avoiding showing an error message, but it doesn't work for some reason...So if there's no variable it shows the text, and if the text has a space it should not show the tooltip but I still get an error message... Strange.
That makes sense based on what I can observe the script doing, but that does not seem like what theA_GuiControl is launched with every mouse movement, so for what I could understand OnMessage thread is launched by the gui and therefore the variable contains the control that launched it. Besides I wouldn't be surprised if MouseGetPos internally used the same 0x200 message.
A_GuiControl
documentation says. Hmm... I may ask Lexikos about this behavior at some point.Thank you again for your kind assistance. 8-)
~Albert Campion
-----------------------------------------------------------------------------------------------
Website | Demo scripts | Blog | External contact
That's it. If a message is posted to the control and that message is being monitored, A_GuiControl is set and a new thread is launched to call the function.The name of the variable associated with the GUI control that launched the current thread.
MouseGetPos doesn't use any messages; it calls GetCursorPos. How could it use a message?Besides I wouldn't be surprised if MouseGetPos internally used the same 0x200 message.
I am still having some trouble wrapping my head around this (it is thick, and does not bend easily).
I guess I just don't understand how in a mousemove OnMessage situation it is the control under the cursor that is considered to have launched the thread. I am assuming I just don't have a clue about how the OnMessage system actually works. Isn't it the mouse moving that launched the thread? How does the control under the cursor come into it? :?The name of the variable associated with the GUI control that launched the current thread.
Sorry to cause trouble.
~Albert Campion
-----------------------------------------------------------------------------------------------
Website | Demo scripts | Blog | External contact
I didn't say it did, was just wondering... I didn't stop to think much about it. Thanks for explaining.MouseGetPos doesn't use any messages; it calls GetCursorPos . How could it use a message?
Rodolfo U. Batista
Pulover's Macro Creator - Automation Tool (Recorder & Script Writer) | Class_LV_Rows - Copy, Cut, Paste and Drag ListViews | Class_Toolbar - Create and modify | Class_Rebar - Adjustable GUI controls
Join the New AutoHotkey Forum!