I would appreciate it if you could take a look at the following code, which is a slightly modified version of this example SetTimer.htm#ExampleClass in the documentation. I added the __Delete() meta-function, but it's not behaving as I would expect it to.
Thank you.
Code: Select all
counter := new SecondCounter
counter.Start()
Sleep 5000
counter.Stop()
Sleep 2000
counter = ; I would expect a ToolTip to show up as a result of this operation
Sleep 2000
Return
; From https://autohotkey.com/docs/commands/SetTimer.htm#ExampleClass
class SecondCounter {
__New() {
this.interval := 1000
this.count := 0
this.timer := ObjBindMethod(this, "Tick")
}
Start() {
timer := this.timer
SetTimer % timer, % this.interval
ToolTip % "Counter started"
}
Stop() {
timer := this.timer
SetTimer % timer, Off
ToolTip % "Counter stopped at " this.count
}
Tick() {
ToolTip % ++this.count
}
; This function is the only addition to the class
__Delete() {
ToolTip Deleting object ...
}
}