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 

Tool Tips for gui controls
Goto page Previous  1, 2
 
Reply to topic    AutoHotkey Community Forum Index -> Wish List
View previous topic :: View next topic  
Author Message
incith



Joined: 01 Oct 2005
Posts: 130
Location: Canada

PostPosted: Wed Sep 13, 2006 2:09 pm    Post subject: Reply with quote

That, or a big If/Else list.. if control == foo, tooltip = bar..else..
Back to top
View user's profile Send private message
Veovis



Joined: 13 Feb 2006
Posts: 389
Location: Utah

PostPosted: Sat Sep 23, 2006 4:31 pm    Post subject: Reply with quote

I tried that at first with an old version of my AHKPad but i found that it takes less work and time and (lines of code) to simple define

Code:
GuiObjectsVar_TT = This is its tooltip


than adding

Code:
If A_guicontrol = GuiObjectsVar
   tooltip = This is its tooltip


as a long list of if/elses can get ugly and (correct me if im wrong) use more cpu time than using a pseudo-array.

Thanks for everyone contributions! I think it would be cool to implement something into AHK go you could define something like

Code:
Gui, add, Button, gSave t"Save the File",Save


hmmm, that doesnt look the best and we cant add another parameter because to many text controls contain commas...

well Control_TT works fine for me so ill stick to that

(and btw i like the new coloring in the code sections! )
_________________

"Power can be given overnight, but responsibility must be taught. Long years go into its making."
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Veovis



Joined: 13 Feb 2006
Posts: 389
Location: Utah

PostPosted: Sat Sep 23, 2006 5:52 pm    Post subject: Reply with quote

Hmmmmm

just ran into a problem

Code:
gui, add, button,gSave,Save File
gui, add, button,gSave vSave, Save File (vSave) works!
gui, add, button,gMoveUp,^
gui, show

Save_tt = this tooltip works


OnMessage(0x200, "WM_MOUSEMOVE")
return

WM_MOUSEMOVE()
{
   static PrevControl, _TT  ; _TT is defined as a static variable (blank) for use by the ToolTip command below.
   CurrControl := A_GuiControl
   If (CurrControl <> PrevControl)
   {
      ToolTip % %CurrControl%_TT
      SetTimer, RemoveToolTip, 4000
      PrevControl := CurrControl
   }
}
RemoveToolTip:
ToolTip
return


Save:
MoveUp:
return


This is very simplified, it is a project im working on with almost all the code removed. Basically the button with the text "Save File" NEEDS to have a variable assigned to it, so that the Tooltip will not complain because it has a space in its name. Also i have many little buttons with things like "+", "-", "^", "v", or just something with a space in it. This isnt a severe problem other than the fact that you HAVE to assign a variable name to everycontrol that might cause a problem. Is there something we can do to fix this?

Hmmm i have an idea! Idea

Code:
gui, add, button,gSave,Save File
gui, add, button,gSave vSave, Save File (vSave) works!
gui, add, button,gMoveUp,^
gui, show

Save_tt = this tooltip works


OnMessage(0x200, "WM_MOUSEMOVE")
return

WM_MOUSEMOVE()
{
   static PrevControl, _TT  ; _TT is defined as a static variable (blank) for use by the ToolTip command below.
   CurrControl := A_GuiControl
   If Illegal(currcontrol)
      return
   If (CurrControl <> PrevControl)
   {
      ToolTip % %CurrControl%_TT
      SetTimer, RemoveToolTip, 4000
      PrevControl := CurrControl
   }
}

RemoveToolTip:
ToolTip
return

Illegal(input)
{
   loop, parse,input
   {
      if A_loopfield is alnum
         continue
      if A_loopfield in #,_,@,$,?,[,]
         continue
      return 1
   }
}

Save:
MoveUp:
return


Notice that it doesnt warn you or anything that the tooltip didnt work. I did this because if it said something like "control name invalid" it defeats the purpose of not wanting to give a vName to every control. So if you use the code above and a tooltip isnt working, check the name
_________________

"Power can be given overnight, but responsibility must be taught. Long years go into its making."
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Reply to topic    AutoHotkey Community Forum Index -> Wish List 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