ToolTip Timeout

Propose new features and changes
need4speed
Posts: 74
Joined: 22 Apr 2016, 06:50

ToolTip Timeout

17 Jun 2019, 14:16

Most modern languages support ToolTip Timeout. The MsgBox command has a Timeout but ToolTip doesn't. The known workarounds are unnecessary bloating the code. Apparently someone made an external function but I prefer to have it properly natively built in. Any plans to implement Timeout for the ToolTip command?
User avatar
TheDewd
Posts: 1352
Joined: 19 Dec 2013, 11:16
Location: USA

Re: ToolTip Timeout

18 Jun 2019, 13:48

I attempted to write my own function for this:

Code: Select all

#SingleInstance, Force
#Persistent

ToolTip("ToolTip Test 1", 100, 100, 1, 2000) ; ToolTip 1
ToolTip("ToolTip Test 2", 100, 400, 2, 4000) ; ToolTip 2
ToolTip("ToolTip Test 3", 200, 600, 3, 6000) ; ToolTip 3

; ToolTip([Text, X, Y, WhichToolTip, Timeout])
ToolTip(Text := "", X := "", Y := "", WhichToolTip := 1, Timeout := "") {
	ToolTip, % Text, X, Y, WhichToolTip

	If (Timeout) {
		RemoveToolTip := Func("ToolTip").Bind(,,, WhichToolTip)
		SetTimer, % RemoveToolTip, % -Timeout
	}
}

Edit: Fixed error found by @tmplinshi
Last edited by TheDewd on 19 Jun 2019, 07:23, edited 4 times in total.
Image Bulldozer - Sokoban inspired game from 1994 recreated in AutoHotkey.
tmplinshi
Posts: 1533
Joined: 01 Oct 2013, 14:57

Re: ToolTip Timeout

18 Jun 2019, 15:05

@TheDewd Nice. But the Timeout parameter shouldn't bind to the function.

Code: Select all

RemoveToolTip := Func("ToolTip").Bind(,,, WhichToolTip)
need4speed
Posts: 74
Joined: 22 Apr 2016, 06:50

Re: ToolTip Timeout

18 Jun 2019, 16:35

TheDewd wrote:I attempted to write my own function
I guess naming your function differently would avoid irritations with the internal ToolTip command.
Spoiler
Here is another attempt incl. timeout and custom colors, though the latter seem not to work on Win7.
User avatar
TheDewd
Posts: 1352
Joined: 19 Dec 2013, 11:16
Location: USA

Re: ToolTip Timeout

19 Jun 2019, 07:21

need4speed wrote:
18 Jun 2019, 16:35
I guess naming your function differently would avoid irritations with the internal ToolTip command.
No, I don't believe so.

The ToolTip command, without the WhichToolTip parameter, will default to ToolTip #1.

The ToolTip command that you added in your example is replacing the example from my function where I specified ToolTip #1 for WhichToolTip.

Code: Select all

; ToolTip([Text, X, Y, WhichToolTip, Timeout])
ToolTip("ToolTip Test 1", 100, 100, 1, 2000)
Renaming the function wouldn't change this behavior.

If you wanted to avoid having the command (without the WhichToolTip parameter) and the function interfering with each other, you should always specify ToolTip #2 and upwards when using the function, never using ToolTip #1.
Image Bulldozer - Sokoban inspired game from 1994 recreated in AutoHotkey.
need4speed
Posts: 74
Joined: 22 Apr 2016, 06:50

Re: ToolTip Timeout

19 Jun 2019, 08:28

@TheDewd thanks for clarifying.

Return to “Wish List”

Who is online

Users browsing this forum: No registered users and 18 guests