I run into some difficulty. Please if someone can shed some light why can't i run class method inside a label. I have marked the code line in question. I think I can solve this prob with RegisterCallback and DllCall, but I'am trying to understand OOP and wanna do the oop way.
Code: Select all
#Persistent
a := new classA()
a.timerSet()
class classA{
test(){
msgbox % "Hello ! classA.test() here"
}
timerSet(){
set(this.test)
}
}
set(call){
static method
method := call
SetTimer, label1, 500
Return
label1:
msgbox % "Running timer..."
msgbox % "Calling " method.name " by reference"
method.() ; <---------------------------------------------------- why this line dont work ?
msgbox % "...nothin..."
msgbox % "Trying directly..."
classA.test()
msgbox % "It works..."
SetTimer, label1, off
return
}