 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
HotKeyIt
Joined: 18 Jun 2008 Posts: 4648 Location: AHK Forum
|
Posted: Tue May 12, 2009 12:59 pm Post subject: |
|
|
Hi Superfraggle, we've got one small issue/problem.
If only 1 Control is associated with ToolTip, ToolTip will not pop up again after it has been hidden by system (not by mouse movements)
Any ideas?
| Code: |
; ### Example Code #####
Gui,Add,Button,hwndbutton1,Test Button 1
AddTooltip(button1,"Press me to change my tooltip")
Gui,show,,Test Gui
Return
GuiClose:
Guiescape:
Exitapp
; ### End Example Code #####
AddToolTip(con,text,Modify = 0){
Static TThwnd,GuiHwnd
If (!TThwnd){
Gui,+LastFound
GuiHwnd:=WinExist()
TThwnd:=CreateTooltipControl(GuiHwnd)
}
Varsetcapacity(TInfo,44,0)
Numput(44,TInfo)
Numput(1|16,TInfo,4)
Numput(GuiHwnd,TInfo,8)
Numput(con,TInfo,12)
Numput(&text,TInfo,36)
Detecthiddenwindows,on
If (Modify){
SendMessage,1036,0,&TInfo,,ahk_id %TThwnd%
}
Else {
Sendmessage,1028,0,&TInfo,,ahk_id %TThwnd%
SendMessage,1048,0,300,,ahk_id %TThwnd%
}
}
CreateTooltipControl(hwind){
Ret:=DllCall("CreateWindowEx"
,"Uint",0
,"Str","TOOLTIPS_CLASS32"
,"Uint",0
,"Uint",2147483648 | 3
,"Uint",-2147483648
,"Uint",-2147483648
,"Uint",-2147483648
,"Uint",-2147483648
,"Uint",hwind
,"Uint",0
,"Uint",0
,"Uint",0)
Return Ret
} |
_________________ AHK_H (2alpha) AHF TT _Struct WatchDir Yaml _Input ObjTree RapidHotkey DynaRun  |
|
| Back to top |
|
 |
Tilex
Joined: 01 Jun 2009 Posts: 5 Location: Germany
|
Posted: Mon Jun 01, 2009 8:05 pm Post subject: |
|
|
first to say: thanks for that feature
but I have one problem:
I want to set a tooltip for an edit-box, which is disabled.
How do I do that? It only shows the tooltip, when it is enabled again.
bye,
Tilex |
|
| Back to top |
|
 |
Superfraggle
Joined: 02 Nov 2004 Posts: 1019 Location: London, UK
|
Posted: Thu Jun 04, 2009 9:20 pm Post subject: |
|
|
HotKeyIt,
Sorry about the delay in getting back to you, I have not been on the forum for a while. Not sure what you mean there.
If you mean let the tooltip close itself, then move mouse to bring it back. If I move the mouse off the control and back on the tooltip reappears.
I am on vista, so that could be an XP bug.
Tilex,
I believe that is standard windows and cannot be bypassed, you would have to write custom tooltips as suggested in the manual. _________________ Steve F AKA Superfraggle
http://r.yuwie.com/superfraggle |
|
| Back to top |
|
 |
HotKeyIt
Joined: 18 Jun 2008 Posts: 4648 Location: AHK Forum
|
Posted: Thu Jun 04, 2009 9:36 pm Post subject: |
|
|
| Superfraggle wrote: | HotKeyIt,
Sorry about the delay in getting back to you, I have not been on the forum for a while. Not sure what you mean there.
If you mean let the tooltip close itself, then move mouse to bring it back. If I move the mouse off the control and back on the tooltip reappears.
I am on vista, so that could be an XP bug.
|
Try this, do not move your mouse until the ToolTip disappears and it will not come back.
I fixed this already in ToolTip() by adding a tool for Gui hWnd, give it a try, many thanks to you.
| Code: |
; ### Example Code #####
Gui,Add,Button,hwndbutton1 Gbut1,Test Button 1
AddTooltip(button1,"Press me to change my tooltip")
Gui,show,,Test Gui
Return
But1:
AddTooltip(button1,"Wasn't that easy `;)",1)
REturn
GuiClose:
Guiescape:
Exitapp
; ### End Example Code #####
AddToolTip(con,text,Modify = 0){
Static TThwnd,GuiHwnd
If (!TThwnd){
Gui,+LastFound
GuiHwnd:=WinExist()
TThwnd:=CreateTooltipControl(GuiHwnd)
}
Varsetcapacity(TInfo,44,0)
Numput(44,TInfo)
Numput(1|16,TInfo,4)
Numput(GuiHwnd,TInfo,8)
Numput(con,TInfo,12)
Numput(&text,TInfo,36)
Detecthiddenwindows,on
If (Modify){
SendMessage,1036,0,&TInfo,,ahk_id %TThwnd%
}
Else {
Sendmessage,1028,0,&TInfo,,ahk_id %TThwnd%
SendMessage,1048,0,300,,ahk_id %TThwnd%
}
}
CreateTooltipControl(hwind){
Ret:=DllCall("CreateWindowEx"
,"Uint",0
,"Str","TOOLTIPS_CLASS32"
,"Uint",0
,"Uint",2147483648 | 3
,"Uint",-2147483648
,"Uint",-2147483648
,"Uint",-2147483648
,"Uint",-2147483648
,"Uint",hwind
,"Uint",0
,"Uint",0
,"Uint",0)
Return Ret
} |
Fix for your function:
| Code: |
; ### Example Code #####
Gui,Add,Button,hwndbutton1 Gbut1,Test Button 1
AddTooltip(button1,"Press me to change my tooltip")
Gui,show,,Test Gui
Return
But1:
AddTooltip(button1,"Wasn't that easy `;)",1)
REturn
GuiClose:
Guiescape:
Exitapp
; ### End Example Code #####
AddToolTip(con,text,Modify = 0){
Static TThwnd,GuiHwnd
If (!TThwnd){
Gui,+LastFound
GuiHwnd:=WinExist()
TThwnd:=CreateTooltipControl(GuiHwnd)
Varsetcapacity(TInfo,44,0)
Numput(44,TInfo)
Numput(1|16,TInfo,4)
Numput(GuiHwnd,TInfo,8)
Numput(GuiHwnd,TInfo,12)
;Numput(&text,TInfo,36)
Detecthiddenwindows,on
Sendmessage,1028,0,&TInfo,,ahk_id %TThwnd%
SendMessage,1048,0,300,,ahk_id %TThwnd%
}
Varsetcapacity(TInfo,44,0)
Numput(44,TInfo)
Numput(1|16,TInfo,4)
Numput(GuiHwnd,TInfo,8)
Numput(con,TInfo,12)
Numput(&text,TInfo,36)
Detecthiddenwindows,on
If (Modify){
SendMessage,1036,0,&TInfo,,ahk_id %TThwnd%
}
Else {
Sendmessage,1028,0,&TInfo,,ahk_id %TThwnd%
SendMessage,1048,0,300,,ahk_id %TThwnd%
}
}
CreateTooltipControl(hwind){
Ret:=DllCall("CreateWindowEx"
,"Uint",0
,"Str","TOOLTIPS_CLASS32"
,"Uint",0
,"Uint",2147483648 | 3
,"Uint",-2147483648
,"Uint",-2147483648
,"Uint",-2147483648
,"Uint",-2147483648
,"Uint",hwind
,"Uint",0
,"Uint",0
,"Uint",0)
Return Ret
} |
_________________ AHK_H (2alpha) AHF TT _Struct WatchDir Yaml _Input ObjTree RapidHotkey DynaRun  |
|
| Back to top |
|
 |
fragman
Joined: 13 Oct 2009 Posts: 1191
|
Posted: Sat May 14, 2011 12:40 pm Post subject: |
|
|
Here's a working version for AHK_L Unicode (x64 untested so far, but should work) | Code: | AddToolTip(con,text,Modify = 0)
{
Static TThwnd,GuiHwnd
l_DetectHiddenWindows:=A_DetectHiddenWindows
If (!TThwnd)
{
Gui,+LastFound
GuiHwnd:=WinExist()
TThwnd:=CreateTooltipControl(GuiHwnd)
Varsetcapacity(TInfo,6*4+6*A_PtrSize,0)
Numput(6*4+6*A_PtrSize,TInfo, "UInt")
Numput(1|16,TInfo,4, "UInt")
Numput(GuiHwnd,TInfo,8, "PTR")
Numput(GuiHwnd,TInfo,8+A_PtrSize, "PTR")
;Numput(&text,TInfo,36)
Detecthiddenwindows,on
Sendmessage,1028,0,&TInfo,,ahk_id %TThwnd%
SendMessage,1048,0,300,,ahk_id %TThwnd%
}
Varsetcapacity(TInfo,6*4+6*A_PtrSize,0)
Numput(6*4+6*A_PtrSize,TInfo, "UInt")
Numput(1|16,TInfo,4, "UInt")
Numput(GuiHwnd,TInfo,8, "PTR")
Numput(con,TInfo,8+A_PtrSize, "PTR")
VarSetCapacity(ANSItext, StrPut(text, ""))
StrPut(text, &ANSItext, "")
Numput(&ANSIText,TInfo,6*4+3*A_PtrSize, "PTR")
Detecthiddenwindows,on
If (Modify)
SendMessage,1036,0,&TInfo,,ahk_id %TThwnd%
Else {
Sendmessage,1028,0,&TInfo,,ahk_id %TThwnd%
SendMessage,1048,0,300,,ahk_id %TThwnd%
}
DetectHiddenWindows %l_DetectHiddenWindows%
}
CreateTooltipControl(hwind)
{
Ret:=DllCall("CreateWindowEx"
,"Uint",0
,"Str","TOOLTIPS_CLASS32"
,"PTR",0
,"Uint",2147483648 | 3
,"Uint",-2147483648
,"Uint",-2147483648
,"Uint",-2147483648
,"Uint",-2147483648
,"PTR",hwind
,"PTR",0
,"PTR",0
,"PTR",0, "PTR")
Return Ret
} |
|
|
| Back to top |
|
 |
uni guest Guest
|
Posted: Sat May 28, 2011 12:06 pm Post subject: |
|
|
fragman, your version doesn't work for unicode characters. Tested on AHK_L 1.1.00.00 unicode. Can you fix it? Test:
| Code: | Gui,Add,Button,hwndbutton1, Test Button 1
AddTooltip(button1,"Ж.И.`nЮ.Щ.")
Gui,show,,Test Gui
Return
GuiClose:
Exitapp
AddToolTip(con,text,Modify = 0)
{
Static TThwnd,GuiHwnd
l_DetectHiddenWindows:=A_DetectHiddenWindows
If (!TThwnd)
{
Gui,+LastFound
GuiHwnd:=WinExist()
TThwnd:=CreateTooltipControl(GuiHwnd)
Varsetcapacity(TInfo,6*4+6*A_PtrSize,0)
Numput(6*4+6*A_PtrSize,TInfo, "UInt")
Numput(1|16,TInfo,4, "UInt")
Numput(GuiHwnd,TInfo,8, "PTR")
Numput(GuiHwnd,TInfo,8+A_PtrSize, "PTR")
;Numput(&text,TInfo,36)
Detecthiddenwindows,on
Sendmessage,1028,0,&TInfo,,ahk_id %TThwnd%
SendMessage,1048,0,300,,ahk_id %TThwnd%
}
Varsetcapacity(TInfo,6*4+6*A_PtrSize,0)
Numput(6*4+6*A_PtrSize,TInfo, "UInt")
Numput(1|16,TInfo,4, "UInt")
Numput(GuiHwnd,TInfo,8, "PTR")
Numput(con,TInfo,8+A_PtrSize, "PTR")
VarSetCapacity(ANSItext, StrPut(text, ""))
StrPut(text, &ANSItext, "")
Numput(&ANSIText,TInfo,6*4+3*A_PtrSize, "PTR")
Detecthiddenwindows,on
If (Modify)
SendMessage,1036,0,&TInfo,,ahk_id %TThwnd%
Else {
Sendmessage,1028,0,&TInfo,,ahk_id %TThwnd%
SendMessage,1048,0,300,,ahk_id %TThwnd%
}
DetectHiddenWindows %l_DetectHiddenWindows%
}
CreateTooltipControl(hwind)
{
Ret:=DllCall("CreateWindowEx"
,"Uint",0
,"Str","TOOLTIPS_CLASS32"
,"PTR",0
,"Uint",2147483648 | 3
,"Uint",-2147483648
,"Uint",-2147483648
,"Uint",-2147483648
,"Uint",-2147483648
,"PTR",hwind
,"PTR",0
,"PTR",0
,"PTR",0, "PTR")
Return Ret
} |
|
|
| Back to top |
|
 |
fragman
Joined: 13 Oct 2009 Posts: 1191
|
Posted: Sat May 28, 2011 4:15 pm Post subject: |
|
|
I know, I'm explicitly converting it to ANSI because the tooltips didn't work with the Unicode version of AHK_L. There might be Unicode versions of the messages used for the tooltip controls, but I don't know about them. Feel free to look them up on MSDN and post a working version  |
|
| Back to top |
|
 |
art
Joined: 23 Sep 2008 Posts: 39
|
Posted: Fri Jun 17, 2011 8:39 am Post subject: |
|
|
[ AHK, AHK_L compatible ]
| Code: |
;================================================================================
AddToolTip(CtrlHwnd,text,Modify=0) { ; ***** Add Multiline ToolTips to any Gui Control ***** [ AHK, AHK_L compatible ]
Static TThwnd, GuiHwnd, Ptr ; - 'Text' and 'Picture' Controls requires a g-label to be defined.
If (!TThwnd){ ; - 'ComboBox' = Drop-Down button + Edit (Get hWnd of the 'Edit' control using "ControlGet" command).
Gui,+LastFound ; - 'ListView' = ListView + Header (Get hWnd of the 'Header' control using "ControlGet" command).
GuiHwnd:=WinExist()
TThwnd:=DllCall("CreateWindowEx","Uint",0,"Str","TOOLTIPS_CLASS32","Uint",0,"Uint",2147483648 | 3,"Uint",-2147483648
,"Uint",-2147483648,"Uint",-2147483648,"Uint",-2147483648,"Uint",GuiHwnd,"Uint",0,"Uint",0,"Uint",0)
Ptr:=(A_PtrSize ? "Ptr" : "UInt"), DllCall("uxtheme\SetWindowTheme","Uint",TThwnd,Ptr,0,"UintP",0) ; TTM_SETWINDOWTHEME
}
Varsetcapacity(TInfo,44,0), Numput(44,TInfo), Numput(1|16,TInfo,4), Numput(GuiHwnd,TInfo,8), Numput(CtrlHwnd,TInfo,12), Numput(&text,TInfo,36)
!Modify ? (DllCall("SendMessage",Ptr,TThwnd,"Uint",1028,Ptr,0,Ptr,&TInfo,Ptr)) ; TTM_ADDTOOL = 1028 (used to add a tool, and assign it to a control)
. (DllCall("SendMessage",Ptr,TThwnd,"Uint",1048,Ptr,0,Ptr,A_ScreenWidth)) ; TTM_SETMAXTIPWIDTH = 1048 (This one allows the use of multiline tooltips)
DllCall("SendMessage",Ptr,TThwnd,"UInt",(A_IsUnicode ? 0x439 : 0x40c),Ptr,0,Ptr,&TInfo,Ptr) ; TTM_UPDATETIPTEXT (OLD_MSG=1036) (used to adjust the text of a tip)
}
|
|
|
| Back to top |
|
 |
fragman
Joined: 13 Oct 2009 Posts: 1191
|
Posted: Fri Jun 17, 2011 9:47 am Post subject: |
|
|
I see you used A_IsUnicode in the Sendmessage call, so I suppose it supports Unicode now?
I noticed that tooltips won't show on DropDownLists/Comboboxes, any idea why? |
|
| Back to top |
|
 |
art
Joined: 23 Sep 2008 Posts: 39
|
|
| Back to top |
|
 |
Astrid Guest
|
Posted: Mon Aug 29, 2011 5:00 pm Post subject: |
|
|
how would I extend the time the tooltip shows itself?
after sorting through several different approaches to create a basic tooltip method for just text labels in a gui this one seems simpler than most (thanks to art for the ahk_L validation) however it seems to be only 5 seconds and the tip closes itself
thanks a lot |
|
| Back to top |
|
 |
art
Joined: 23 Sep 2008 Posts: 39
|
|
| Back to top |
|
 |
Guest
|
Posted: Sun Sep 04, 2011 8:47 am Post subject: |
|
|
hi, i tested the thread first post and got this result, can somebody explain, why it only shows the first letter ?
i am using AHK_L latest version and Windows XP 32bit |
|
| Back to top |
|
 |
Guest
|
Posted: Sun Sep 04, 2011 9:01 am Post subject: |
|
|
| please delete my last post, thanks |
|
| Back to top |
|
 |
tfwall112
Joined: 17 Sep 2011 Posts: 16
|
Posted: Sat Nov 12, 2011 10:04 pm Post subject: A little help please |
|
|
OK, I finally got this script to work for me, but when I hover for a tooltip, it only shows the first letter (much like the last post, and he didnt leave a fix lol)
Can someone tell me where I need to look?
Thanks, Terry |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|