AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Add ToolTips to controls.
Goto page Previous  1, 2
 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions
View previous topic :: View next topic  
Author Message
HotKeyIt



Joined: 18 Jun 2008
Posts: 2195
Location: GERMANY

PostPosted: Tue May 12, 2009 1:59 pm    Post subject: Reply with quote

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
}

_________________
AutoHotFile - ToolTip(n,text,title,options) Wink
Back to top
View user's profile Send private message
Tilex



Joined: 01 Jun 2009
Posts: 1
Location: Germany

PostPosted: Mon Jun 01, 2009 9:05 pm    Post subject: Reply with quote

first to say: thanks for that feature Smile

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
View user's profile Send private message
Superfraggle



Joined: 02 Nov 2004
Posts: 1019
Location: London, UK

PostPosted: Thu Jun 04, 2009 10:20 pm    Post subject: Reply with quote

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
View user's profile Send private message MSN Messenger
HotKeyIt



Joined: 18 Jun 2008
Posts: 2195
Location: GERMANY

PostPosted: Thu Jun 04, 2009 10:36 pm    Post subject: Reply with quote

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
}

_________________
AutoHotFile - ToolTip(n,text,title,options) Wink
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions All times are GMT
Goto page Previous  1, 2
Page 2 of 2

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group