I have been looking for an example of ToolTipGui, which is in line of TooTipOpt.
something like (pseudo-code, totally not working, maybe a little bit):
Code: Select all
;-------------------------------------------------------------------------------
; ToolTipGui.ahk
;-------------------------------------------------------------------------------
#NoEnv
SetBatchLines, -1
new ToolTipGui.Options := [["#", "Center"], ["x"], ["y"]]
; make Points array
p0 := {x: 100, y: 100}
p1 := {x: 500, y: 500}
p2 := {x: 500, y: 100}
p3 := {x: 100, y: 500}
Points := [p0, p1, p2, p3]
; test
ToolTip, Points
loop 100 {
p0.x ++, p0.y --, p1.x += 2, p1.y -= 3
ToolTip, Points
sleep 50 ; ~5 sec total time
}
ExitApp ; end of auto-execute section
ToolTipGui(Options := "", Name := "", hwnd := "") {
if (hwnd = "")
_TTG("Gui", "", "")
_TTHook()
}
_TTHook() {
static hook := 0
if !hook
hook := DllCall("SetWindowsHookExW", "int", 4
, "ptr", RegisterCallback("_TTWndProc"), "ptr", 0
, "uint", DllCall("GetCurrentThreadId"), "ptr")
}
_TTWndProc(nCode, _wp, _lp) {
Critical 999
;lParam := NumGet(_lp+0*A_PtrSize)
;wParam := NumGet(_lp+1*A_PtrSize)
uMsg := NumGet(_lp+2*A_PtrSize, "uint")
hwnd := NumGet(_lp+3*A_PtrSize)
if (nCode >= 0 && (uMsg = 1081 || uMsg = 1036)) {
_hack_ = ahk_id %hwnd%
WinGetClass wclass, %_hack_%
if (wclass = "tooltips_class32") {
;~ ToolTipColor(,, hwnd)
;~ ToolTipFont(,, hwnd)
}
}
return DllCall("CallNextHookEx", "ptr", 0, "int", nCode, "ptr", _wp, "ptr", _lp, "ptr")
}
_TTG(Cmd, Arg1, Arg2 := "") {
static htext := 0, hgui := 0
if !htext {
Gui _TTG: Add, Text, +hwndhtext
Gui _TTG: +hwndhgui +0x40000000
}
Gui _TTG: %Cmd%, %Arg1%, %Arg2%
if (Cmd = "Gui") {
Gui _TTG: Add, ListView
return ErrorLevel
}
}
Background: I want to experiment with using the TooTip command to show a custom GUI.
What I want to improve on: my old debugging helpers, namely TV_show and LV_show.
There is no problem that I found yet, but it is noticeable that TV_show is struggling with performance, when compared to LV_show.
My current knowledge is limited, The helpers do well in my use-cases (debugging does not need to be faster, I want to be able to read the output ,
But there is this question that I never dared to ask in public: Does anybody understand this hint/note by Lexikos in this thread? https://www.autohotkey.com/boards/viewtopic.php?p=27472#p27472
Lexikos wrote:Notes:
It's possible to embed a GUI into a tooltip window.
TV_show
LV_show
In case this topic makes sense to anybody and that person is able to tell me, that I am completely mistaken, please come forward to tell me.Thanks for reading!