Old
I've been relying on this means to extend the Gui class in a way that doesn't interfere with other means of extensions.
Is this possibly relating to a change I missed in AHK v2 updates? Or should this still work?
I have tried several different variations, including making an instance of test class and trying to attach method from test.base.NewMethod. All the same.
To me, the weird part is that the error doesn't happen when attaching the method in Static __New().
I have also tried commenting out Static __New() and putting the new method assignment directly above the Gui.NewMethod() call to ensure the order of operations wasn't somehow muttled, and still same error as below.
Error message:
I also tried extending the Gui class directly and I'm having the same issue:
Also also... I got an error message on one of my scripts saying that Gui.Custom was an unknown class again. Having trouble replicating this one since the above error is now the main error I'm struggling with.
EDIT: It seems the "Gui.Custom doesn't exist" error I got with a134 was a fluke, during my attempts to convert my scripts for a134.
Code: Select all
g := Gui()
g.NewMethod()
class test {
Static __New() {
Gui.Prototype.NewMethod := ObjBindMethod(this, "NewMethod")
}
Static NewMethod(_obj) {
msgbox "I'm new here."
}
}
Is this possibly relating to a change I missed in AHK v2 updates? Or should this still work?
I have tried several different variations, including making an instance of test class and trying to attach method from test.base.NewMethod. All the same.
To me, the weird part is that the error doesn't happen when attaching the method in Static __New().
I have also tried commenting out Static __New() and putting the new method assignment directly above the Gui.NewMethod() call to ensure the order of operations wasn't somehow muttled, and still same error as below.
Error message:
Code: Select all
---------------------------
__test_v2.ahk
---------------------------
Error: This value of type "Class" has no method named "NewMethod".
Line#
001: t := test()
002: Gui.Prototype.NewMethod := t.NewMethod
---> 003: Gui.NewMethod()
005: test
005: {
000: }
006: {
008: }
010: {
011: msgbox("I'm new here.")
Try to continue anyway?
---------------------------
Yes No
---------------------------
I also tried extending the Gui class directly and I'm having the same issue:
Code: Select all
g := Gui()
g.NewMethod() ; <-- same error as above
class test extends Gui {
Static __New() {
Gui.Prototype := this.Prototype ; I've done this before and it worked.
}
NewMethod() {
msgbox "I'm new here."
}
}
EDIT: It seems the "Gui.Custom doesn't exist" error I got with a134 was a fluke, during my attempts to convert my scripts for a134.