When accessing this in the MenuHandler method, it does not returns the class, but the string "Option1".
Is this normal? I was expecting the class.
What is the best advice to manage this properly?
- Changing this.MenuHandler in this.MenuHandler.bind(this) (this works, but seems like a lot of extra code...)
- Moving MenuHandler to inside the __New method would also work, but then it is not accessible anymore...
Code: Select all
#Requires AutoHotKey v2.0
GuiClass()
Class GuiClass extends Gui{
__New(FilePath := "") {
super.__New("+Resize") ; Create the gui
MyMenuBar := MenuBar()
MyMenuBar.Add("Option1", this.MenuHandler)
this.MenuBar := MyMenuBar
this.Edit := this.AddEdit()
this.Show("w300 h100")
}
MenuHandler(*){
MsgBox(this)
}
}