How to create a callback of a method inside a Class ?
Posted: Tue Mar 24, 2020 1:21 am
With the following :Namespace
If I type Test1.Make and close the Form created I will get the expected message from the onClosing handler (Form of Namespace Test1 is closing).
Now with the following :Class that is identical to the previous :Namespace
If I do test2 ← ⎕new Test2 and close the Form created I will get the error: Method not found FormClosingEvent.
What do I need to do for :Class callback to find the method inside the class that it was created from ?
Thanks in advance.
Code: Select all
:Namespace Test1
:Using System.Windows.Forms,System.Windows.Forms.dll
∇ Make
:Access Public
form←⎕NEW Form
form.Text←'Form of Namespace Test1'
form.add_Closing(⎕OR'FormClosingEvent')
form.Show ⍬
∇
∇ FormClosingEvent(sender event)
:Access Public
sender.Text,' is closing'
∇
:EndNamespace
If I type Test1.Make and close the Form created I will get the expected message from the onClosing handler (Form of Namespace Test1 is closing).
Now with the following :Class that is identical to the previous :Namespace
Code: Select all
:Class Test2
:Using System.Windows.Forms,System.Windows.Forms.dll
∇ Make
:Access Public
:Implements Constructor
form←⎕NEW Form
form.Text←'Form of Class Test2'
form.add_Closing(⎕OR'FormClosingEvent')
form.Show ⍬
∇
∇ FormClosingEvent(sender event)
:Access Public
sender.Text,' is closing'
∇
:EndClass
If I do test2 ← ⎕new Test2 and close the Form created I will get the error: Method not found FormClosingEvent.
What do I need to do for :Class callback to find the method inside the class that it was created from ?
Thanks in advance.