Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

[AHL_L/v2] TT() - Full-blown ToolTip Library


  • Please log in to reply
197 replies to this topic
HotKeyIt
  • Moderators
  • 7439 posts
  • Last active: Jun 22 2016 09:14 PM
  • Joined: 18 Jun 2008
I just remember there is an undocumented feature :roll:
Pass "" for icon index to load the icon from a bmp, jpg and other files instead showing associated icon.
I have updated the docs.
TT.Icon("x:\Pic.jpg",[color=red]""[/color])
For Example:
TT:=TT(), TT.Show("Text","","","Title","x:\Picture.jpg",[color=red]""[/color])

All ToolTip Messages are wrapped.
For Example to set margin use
TT.SetMargin(top:=50,left:=50,bottom:=50,right:=50)

Loading a Picture control onto ToolTip is little more complex :(

HotKeyIt
  • Moderators
  • 7439 posts
  • Last active: Jun 22 2016 09:14 PM
  • Joined: 18 Jun 2008
Added Font support, thanks majkinetor for HE_SetFont
T:=TT("CloseButton OnClose=TTClose")

T.[color=red]Font[/color]("s20 italic strikeout underline bold,Times New Roman")

T.Show("Hello World","","","Title")

Return

TTClose(){

	ExitApp

}


dysmas
  • Members
  • 63 posts
  • Last active: Apr 06 2011 11:01 AM
  • Joined: 28 Dec 2010
Thanks a lot, just what I needed.
There is a little mistake in the example : The font is not changed if you have a comma after s20. The doc says :

ToolTip.Font("S20 bold italic striceout underline, Arial")

and it works fine (but for striceout, instead of strikeout).

I suggest :

T.Font("s20 italic strikeout underline bold,Times New Roman")


HotKeyIt
  • Moderators
  • 7439 posts
  • Last active: Jun 22 2016 09:14 PM
  • Joined: 18 Jun 2008
Thanks I have changed above ;)

dysmas
  • Members
  • 63 posts
  • Last active: Apr 06 2011 11:01 AM
  • Joined: 28 Dec 2010
I noticed also a small error in the code
line 408 you have written noAlimate instead of noAnimate.

I was unable to have NoFade work. I tried with NOFADE since it is written like that in the code, but that does not make a difference. My command is :
T:=TT(" NoAnimate NoFade MAXWIDTH=300")  ; initialize tooltip
Fade is annoying for me because it needs a delay between a T.Hide() and T.show() and sometimes the real delay (from my code) is too short and the tooltip does not appear. Workarounds are possible, but perhaps there is a bug in the code.

But what you have done is a masterwork, thanks.

HotKeyIt
  • Moderators
  • 7439 posts
  • Last active: Jun 22 2016 09:14 PM
  • Joined: 18 Jun 2008
Thanks dysmas, this is fixed now, please redownload;)

dysmas
  • Members
  • 63 posts
  • Last active: Apr 06 2011 11:01 AM
  • Joined: 28 Dec 2010
Hello HotkeyIt,

I was unable to have NoFade work. The example below shows the problem. You will see Hello and Hello3 but not Hello 2.
But I found a workaround which is fine for me :
T.Text("") hides the tooltip without fading effect. Try to change in the example T.Hide() in T.Text(""), then you see Hello 2 (and not Hello 3 for the same reason, unless you change the second T.Hide() as well.
Hello 2 will be visible with T.Hide() if sleep is more than 250
This on XP ,SP3.

No problem for me, now, but I thought you would be interested.

#include libs\struct.ahk
#include libs\tt.ahk

T:=TT("NoFade background=dddddd color=ff0000 ",,"Title") 
T.Font("s22, Arial")
T.show("Hello")
sleep 2000

[color=red]T.Hide("")
;T.text("")[/color]
sleep 100

T.Show("Hello 2")
sleep 2000

T.Hide()
sleep 100

T.Show("Hello 3")
sleep 2000

ExitApp


HotKeyIt
  • Moderators
  • 7439 posts
  • Last active: Jun 22 2016 09:14 PM
  • Joined: 18 Jun 2008
Thanks dysmas, this has been fixed ;)

Btw. NoFade only disables fade-in (showing ToolTip), not fade-out (hiding ToolTip).
You can disable Fading/Animation globally:
[color=white];[/color] www.msdn.microsoft.com/en-us/library/ms724947.aspx
DllCall("SystemParametersInfo", "UInt", SPI_SETTOOLTIP[color=red]ANIMATION[/color]:=0x1017, "UInt", 0, "UInt", [color=brown]Fade[/color]Slide:=[color=brown]1[/color], "UInt", 0)
;I can't see the ToolTip sliding :?:
DllCall("SystemParametersInfo", "UInt", SPI_SETTOOLTIP[color=red]FADE[/color]:=0x1019, "UInt", 0, "UInt", [color=brown]Enable[/color]Disable:=[color=brown]1[/color], "UInt", 0)


dysmas
  • Members
  • 63 posts
  • Last active: Apr 06 2011 11:01 AM
  • Joined: 28 Dec 2010

NoFade only disables fade-in (showing ToolTip), not fade-out (hiding ToolTip).

Thanks for the information, it was important to know that. But
T.Text("")
does the trick perfectly.

One question : if the values for x and y are too large, the tooltip is positioned on the top right of the screen. Right is OK, but I would have expected bottom. I checked your code, it seems to be a Windows' behavior.

Otherwise it works fine, Thanks.

I suggest this addition to the doc (because I needed some time to figure it out :

Since the Icon is in the title, it will appear only if there is a title.

HotKeyIt
  • Moderators
  • 7439 posts
  • Last active: Jun 22 2016 09:14 PM
  • Joined: 18 Jun 2008
Thanks dysmas, I have updated documentation ;)

dysmas
  • Members
  • 63 posts
  • Last active: Apr 06 2011 11:01 AM
  • Joined: 28 Dec 2010
Hello, HotkeyIt,
Windows 7 users report a small problem : the "trayicon" option does not work, the tooltip is shown at the mouse position, which means that the coordinates reported were 0,0. Even if the tray icon is visible, this happens. I don't have Windows 7 and cannot investigate.

HotKeyIt
  • Moderators
  • 7439 posts
  • Last active: Jun 22 2016 09:14 PM
  • Joined: 18 Jun 2008
32 or 64-bit?

dysmas
  • Members
  • 63 posts
  • Last active: Apr 06 2011 11:01 AM
  • Joined: 28 Dec 2010

32 or 64-bit?

Good question, I don't know. I will ask.

HotKeyIt
  • Moderators
  • 7439 posts
  • Last active: Jun 22 2016 09:14 PM
  • Joined: 18 Jun 2008
Can you ask to try again, TrayIcon should work now.

EDIT:
Fixed to show ToolTip correct when (mouse_position > A_ScreenHeight - 20)

dysmas
  • Members
  • 63 posts
  • Last active: Apr 06 2011 11:01 AM
  • Joined: 28 Dec 2010
Hello, there is some delay because I had no version ready. I just transmitted the last beta to the beta testers and I post the information asap. Thanks a lot.