Hi,
I have some code in my main application class:
THIS-OBJECT:ultraButton1:Click:SUBSCRIBE(THIS-OBJECT:ultraButton1_Click)
I'd like to change this to call another class like so:
THIS-OBJECT:ultraButton1:Click:SUBSCRIBE(noddies.MyAction:MyEvent_Event)
Here's the class:
USING Progress.Lang.*.
USING Progress.Windows.Form.
CLASS noddies.MyAction :
CONSTRUCTOR PUBLIC MyAction():
END CONSTRUCTOR.
METHOD PUBLIC VOID MyEventMethod():
END METHOD.
METHOD STATIC PUBLIC VOID MyEvent_Event( INPUT sender AS System.Object, INPUT e AS System.EventArgs ):
MESSAGE "hello from my action"
VIEW-AS ALERT-BOX.
END METHOD.
END CLASS.
Both classes compile but...
Unfortunately, when switching to the design view of the calling class in Architect I get the following error:
Line 269: Unable to locate element MyEvent_Event in type noddies.MyAction
Is what I want to do possible, or even desirable? My intention is to have a smaller main class file by encapsualting the events in external classes.
Thanks,
Saquib.
saquib schrieb:
Hi,
I have some code in my main application class:
THIS-OBJECT:ultraButton1:Click:SUBSCRIBE(THIS-OBJECT:ultraButton1_Click)
I'd like to change this to call another class like so:
THIS-OBJECT:ultraButton1:Click:SUBSCRIBE(noddies.MyAction:MyEvent_Event)
Within the Form, did you make the change within the generated code in the InitializeComponent method?
That's not a recommended approach and I guess, that's why the Visual Designer is failing to parse the code.
I'd suggest, that you hand-code the Event subscription in the constructor, after the call to the InitilaizeComponent methode.
Thanks, that works fine :-)