In AHK 2.0.2, how to add new property to the String class?
How to add new method to any class, since there's no more DefineMethod method>
DefineProp() and DefineMethod() Topic is solved
-
- Posts: 4371
- Joined: 29 Mar 2015, 09:41
- Contact:
Re: DefineProp() and DefineMethod() Topic is solved
Adding Properties and Methods
Code: Select all
class MyClass {
}
MyClass.DefineProp('NewMethod', {Call: (this, params*) => MsgBox(params[1])})
MyClass.NewMethod('test')
MyClass.DefineProp('AnotherMethod', {Call: myFunc})
MsgBox MyClass.AnotherMethod('a', 'b', 'c')
myFunc(this, params*) {
s := ''
for param in params
s .= param . ' '
return s
}
Re: DefineProp() and DefineMethod()
Thank you!!!
Who is online
Users browsing this forum: Bing [Bot], kunkel321 and 38 guests