script error kept on telling me: Gui.Button has no property buttonTS. I'm a try it till it works level at programming. my last CS class was over 20 years ago, and I rarely ever program. So if someone could explain why the second assignment with the Bind works, but the third doesn't, I 'd appreciate it.
Code: Select all
Class TargetingInterface extends Gui {
__New() {
super.__New("+Resize",, this)
this.buttonToT := super.Add("Button", "x0 y0 w36 h12", "ToT")
this.buttonTM := super.Add("Button", "x0 y12 w36 h12", "TM")
this.buttonTS := super.Add("Button", "x0 y24 w36 h12", "TS")
this.buttonToT.OnEvent("Click", "ToTselect") ; works!
this.buttonTM.OnEvent("Click", this.TMselect.Bind(this)) ;also works!
this.buttonTS.OnEvent("Click", this.TSselect()) ; doesn't work, and this was what I thought should work...
this.preamble := ""
this.ToTselect()
this.Show
}
;Target of Main Target
ToTselect(*) {
this.buttonTM.Enabled := 1
this.buttonTS.Enabled := 1
this.buttonTOT.Enabled := 0
this.preamble := "F2, k"
}
;TargetMain
TMselect(*) {
this.buttonToT.Enabled := 1
this.buttonTS.Enabled := 1
this.buttonTM.Enabled := 0
this.preamble := "F2"
}
;Target Self
TSselect(*) {
this.buttonTOT.Enabled := 1
this.buttonTM.Enabled := 1
this.buttonTS.Enabled := 0
this.preamble := "F1"
}
getPreamble() {
return this.preamble
}
}
t_win := TargetingInterface()