I'm trying to wrap my head around regular objects acting as function object in the SetTimer command and can't figure it. Any help highly appreciated.
My idea is to set a timer for every instantiated object. The responsibility of creating the timer is given to another object though. Looks something like this:
Code: Select all
class CButtonMap {
inputButton := {}
Call() {
...
}
load( inputString ) {
this.inputButton := New CInputButton( inputString, this.() )
}
}
class CInputButton {
__New( inputString, onButtonPressed ) {
; checking onButtonPressed here shows the variable being empty
Hotkey % inputString, onButtonPressed
}
}
I suspect using this.() doesn't give me a proper Function Object, as well as %this%() but can't find any examples of how to actually do it.