-
Notifications
You must be signed in to change notification settings - Fork 72
/
Copy pathHideInfotipOnMouseOver.ahk
57 lines (43 loc) · 1.51 KB
/
HideInfotipOnMouseOver.ahk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
HideInfotipOnMouseOver(fnInfotipText,ByRef fnInfotipID)
{
; hides a given infotip when the mouse moves over it
; MsgBox fnInfotipText: %fnInfotipText%`nfnInfotipID: %fnInfotipID%
; declare local, global, static variables
Global itXdefault, itYdefault, TicketInfotipX, TicketInfotipY, TicketInfotipW, TicketInfotipH, TicketInfotipID
Try
{
; set default return value
ReturnValue := 0 ; success
; validate parameters
; initialise variables
CoordMode, Mouse, Screen ; relative to screen
MouseGetPos, mX, mY ; get mouse position
; hide or reveal the infotip
If (mX >= TicketInfotipX && mX <= TicketInfotipX+TicketInfotipW && mY >= TicketInfotipY && mY <= TicketInfotipY+TicketInfotipH) ; if mouse is in infotip area
{
IfWinExist, ahk_id %fnInfotipID% ; and it is showing
Infotip("",,,"TicketInfo") ; close it
}
Else ; if mouse is not in infotip area
{
IfWinNotExist, ahk_id %fnInfotipID% ; and its not showing
Infotip(fnInfotipText,itXdefault,itYdefault,"TicketInfo",,TicketInfotipX,TicketInfotipY,TicketInfotipW,TicketInfotipH,TicketInfotipID) ; show it
}
}
Catch, ThrownValue
{
ReturnValue := !ReturnValue
CatchHandler(A_ThisFunc,ThrownValue.Message,ThrownValue.What,ThrownValue.Extra,ThrownValue.File,ThrownValue.Line,0,0,0)
}
Finally
{
}
; return
Return ReturnValue
}
/* ; testing
SomeInfotipText := 'Here is some text"
SomeInfotipID := "0x"
ReturnValue := HideInfotipOnMouseOver(SomeInfotipText,SomeInfotipID)
MsgBox, HideInfotipOnMouseOver`n`nReturnValue: %ReturnValue%
*/