Jump to content

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

ToolTip() - Advanced ToolTip features + Unicode


  • Please log in to reply
130 replies to this topic

Poll: Do you think AutoHotkey should have that features/function internally? (26 member(s) have cast votes)

Do you think AutoHotkey should have that features/function internally?

  1. Yes (10 votes [38.46%])

    Percentage of vote: 38.46%

  2. Yes, even more ToolTip features please (10 votes [38.46%])

    Percentage of vote: 38.46%

  3. No, I don (0 votes [0.00%])

    Percentage of vote: 0.00%

  4. No, to complex to use (4 votes [15.38%])

    Percentage of vote: 15.38%

  5. No (2 votes [7.69%])

    Percentage of vote: 7.69%

Vote Guests cannot vote
Drugwash
  • Members
  • 1078 posts
  • Last active: May 24 2016 04:20 PM
  • Joined: 07 Sep 2008
I thought I could turn all tooltips into balloons sistem-wide but that wouldn't enlarge maximum text size anyway, neither would it offer any other advantages without applications' support, so better forget that idea. :)

In the example, the coordinates are read relative to the screen but tooltip processes them relative to the window so there's a discrepancy (at least that's what I recall from the test before I posted).

Thanks for considering my reports.

HotKeyIt
  • Moderators
  • 7439 posts
  • Last active: Jun 22 2016 09:14 PM
  • Joined: 18 Jun 2008
New Options, Many Thanks to Superfraggle for Add ToolTips to controls.

phwnd - Parent window hwnd (necessary for addtool below)
ahwnd - ControlId to show ToolTip for, can be class=(Static1,Edit1), can be empty=(If P="" show for parent window only)


Example script: See top post.

jballi
  • Members
  • 1029 posts
  • Last active:
  • Joined: 01 Oct 2005
Looks useful. Thanks for sharing. 8)

jballi
  • Members
  • 1029 posts
  • Last active:
  • Joined: 01 Oct 2005
Question: What is the purpose of the following code in your example:
OnMessage(0x4E,"test")
Just curious...

Edit: Also, I can't figure out what the _tool_tip_id_ parameter is used other than if it is blank or zero, all tooltip windows are deleted. In your example, I changed the value of _tool_tip_id_ parameter for all the examples to an arbitrary number (42) and it worked the same as before. Once again, just curious.

HotKeyIt
  • Moderators
  • 7439 posts
  • Last active: Jun 22 2016 09:14 PM
  • Joined: 18 Jun 2008
Thanks jballi, I've removed OnMessage, this was not necessary.

_tool_tip_id_ is used for ToolTip number, it is stored in static variable like an array:
_tt_hwnd_list_.= "|" . _tool_tip_id_ . "." . hWnd . "|"


HotKeyIt
  • Moderators
  • 7439 posts
  • Last active: Jun 22 2016 09:14 PM
  • Joined: 18 Jun 2008
A few bug fixes:

- Reset control works now. (Set new text and Title and Icon and ...)
- ToolTip displayed better and faster.
- All in one function now ToolTip(), using sub routines.
- Delay option works for ToolTip assosiated with GUI or Control as well.

Enjoy ;)

jballi
  • Members
  • 1029 posts
  • Last active:
  • Joined: 01 Oct 2005

A few bug fixes:

Nice changes. I just started playing with it but I had couple of comments...

1) Your example kills all Tooltips too quickly (3 seconds) after the GUI is displayed. It makes it look like your example works for a couple of tooltips and then stops working entirely. You might add a warning dialog (OK) or attach the "Clear All ToolTips" action to one of the buttons (better). Just a thought...

2) You might want to put your example in the first post. That way folks don't have to search through the thread for a latest example. Just a thought...

3) Whatever code you put in to make "ToolTip displayed better and faster" makes the balloon tooltips appear jumpy if moving the cursor from one balloon tooltip to another balloon tooltip. This is not a big deal for me since I don't plan to use many balloon tooltips but I thought I would point it out.

Addendum:
4) The "Click to Change" example doesn't work (at least for me). A new tooltip appears briefly but then when the cursor is moved away and then back, no tooltip is displayed for the two "ToolTip 1" buttons.

Keep up the good work! :)

HotKeyIt
  • Moderators
  • 7439 posts
  • Last active: Jun 22 2016 09:14 PM
  • Joined: 18 Jun 2008

A few bug fixes:

Nice changes. I just started playing with it but I had couple of comments...

1) Your example kills all Tooltips too quickly (3 seconds) after the GUI is displayed. It makes it look like your example works for a couple of tooltips and then stops working entirely. You might add a warning dialog (OK) or attach the "Clear All ToolTips" action to one of the buttons (better). Just a thought...

2) You might want to put your example in the first post. That way folks don't have to search through the thread for a latest example. Just a thought...

3) Whatever code you put in to make "ToolTip displayed better and faster" makes the balloon tooltips appear jumpy if moving the cursor from one balloon tooltip to another balloon tooltip. This is not a big deal for me since I don't plan to use many balloon tooltips but I thought I would point it out.

Addendum:
4) The "Click to Change" example doesn't work (at least for me). A new tooltip appears briefly but then when the cursor is moved away and then back, no tooltip is displayed for the two "ToolTip 1" buttons.

Keep up the good work! :)


1 removed
2 gone
3 je I know, will check if possible to fix, looks like it is being redrawn.
4 should work now

Thank you ;)

ruespe
  • Members
  • 567 posts
  • Last active: Dec 01 2014 07:59 PM
  • Joined: 17 Jun 2008
Nice job. :p
Das kann ich gut gebrauchen. Danke daf├╝r.

Drugwash
  • Members
  • 1078 posts
  • Last active: May 24 2016 04:20 PM
  • Joined: 07 Sep 2008
Observations on the latest version:
- the timeout popup flickers like mad (happened in previous version too)
- the GUI tooltip appears even when hovering titlebar or min/max/close buttons (happened in previous version too)
- tooltip for button ToolTip1 (after change - the blue one) remains on screen until clicking the button again and then won't show up anymore
- inconsistent spelling throughout the script; correct is balloon and associated. :oops:
- close button won't show up in tooltips (Win9x issue, reported only for whoever wonders if it works)

Everything else works fine. Thanks for the continuous improvements. 8)

ruespe nli
  • Guests
  • Last active:
  • Joined: --
It seems, as If X and Y don't work any more. When I include them, no tooltip is shown. When I delete them, ToolTip is shown near mousepointer.

HotKeyIt
  • Moderators
  • 7439 posts
  • Last active: Jun 22 2016 09:14 PM
  • Joined: 18 Jun 2008

Observations on the latest version:
1 the timeout popup flickers like mad (happened in previous version too)
2 the GUI tooltip appears even when hovering titlebar or min/max/close buttons (happened in previous version too)
3 tooltip for button ToolTip1 (after change - the blue one) remains on screen until clicking the button again and then won't show up anymore
4 inconsistent spelling throughout the script; correct is balloon and associated. :oops:
5 close button won't show up in tooltips (Win9x issue, reported only for whoever wonders if it works)

Everything else works fine. Thanks for the continuous improvements. 8)

Many thanks for testing and feedback
1. Can you try again, hope it is better now
2. Not sure how to get rid of that.
- Possibly it is better to associate the ToolTip to a GroupBox!?!
3. should work now
4. :oops:
5. Thank you, I will add to top post.

Posted: Wed May 13, 2009 5:57 pm Post subject:
It seems, as If X and Y don't work any more. When I include them, no tooltip is shown. When I delete them, ToolTip is shown near mousepointer.

Should work now ;)

HotKeyIt
  • Moderators
  • 7439 posts
  • Last active: Jun 22 2016 09:14 PM
  • Joined: 18 Jun 2008
New functions, see top post ;)
hIcon:= GetAssociatedIcon(A_AhkPath) 
ToolTip(1,"Test","AutoHotkey","I" . hIcon)


Drugwash
  • Members
  • 1078 posts
  • Last active: May 24 2016 04:20 PM
  • Joined: 07 Sep 2008
Flickering still not fixed, but the rest looks good. :)

Incidentally, few days ago I stumbled into an interesting couple of functions that I needed for one of my toys - hopefully you find them useful:
; http://msdn.microsoft.com/en-us/library/bb776414(VS.85).aspx
; shell32.dll
; Extracts the associated icon's index for the file specified in path
; Requires path and icon index
; Icon must be destroyed when no longer needed (see below)

ExtractAssociatedIcon(ByRef ipath, ByRef idx)
{
hInst=0	; reserved, must be zero
hIcon := DllCall("ExtractAssociatedIcon", "UInt", hInst, "UInt", &ipath, "UShortP", idx)
return ErrorLevel
}

; http://msdn.microsoft.com/en-us/library/bb776415(VS.85).aspx
; shell32.dll
; Extracts the associated icon's index and ID for the file specified in path
; Requires path, icon index and ID
; Icon must be destroyed when no longer needed (see below)

ExtractAssociatedIconEx(ByRef ipath, ByRef idx, ByRef iID)
{
hInst=0	; reserved, must be zero
hIcon := DllCall("ExtractAssociatedIconEx", "UInt", hInst, "UInt", &ipath, "UShortP", idx, "UShortP", iID)
return ErrorLevel
}

DestroyIcon(hIcon)
{
DllCall("DestroyIcon", UInt, hIcon)
}


hoppfrosch
  • Members
  • 399 posts
  • Last active: Feb 26 2016 05:31 AM
  • Joined: 25 Jan 2006
Could you please give an example to add a tooltip to the traybar?

I already tried the following, but didn't succeed
ControlGet, Tray_hWnd, hWnd,, TrayNotifyWnd1  , ahk_class Shell_TrayWnd
ToolTip(6,"This is a ToolTip with Title and close button","Welcome","C1 D5 P" . Tray_hWnd)