Is THIS-OBJECT of non-UI class not a System.Object?

Posted by jquerijero on 01-Jun-2010 11:14

I'm trying to define a custom event inside a non-UI class.

USING Progress.Lang.*.


CLASS df.NotesModel:
 
DEFINE PUBLIC EVENT FetchCallbackReturned  SIGNATURE VOID (INPUT sender AS System.Object, INPUT DATASET FOR dsNotes, INPUT e AS System.EventArgs).

CONSTRUCTOR PUBLIC NotesModel (  ):
  SUPER (). 
  . . .
 
END CONSTRUCTOR.

METHOD PUBLIC VOID CallBackMethod( INPUT DATASET dsNotes BIND):
 
  THIS-OBJECT:FetchCallbackReturned:Publish(THIS-OBJECT, DATASET dsNotes, NEW System.EventArgs()).
 
END METHOD.

END CLASS.

"Parameter 1 of for the Publish method of the event FetchCallbackReturned is not type compatible with the signature of the event."

Is this a limitation or a bug?

All Replies

Posted by Admin on 01-Jun-2010 11:19

Unless you are not explicitly inheriting System.Object, I'm glad that

the answer is No!

Posted by Admin on 01-Jun-2010 11:24

It's a feature. Add

INHERITS System.Object

to your CLASS statement and your code should run. In the AVM

System.Object is NOT the base for everything.

Posted by Peter Judge on 01-Jun-2010 11:29

to your CLASS statement and your code should run. In the AVM

System.Object is NOT the base for everything.

>

Just to round out that sentence,

Progress.Lang.Object is the base for EVERYTHING (including System.Object in GUI for .NET).

-- peter

Posted by jquerijero on 01-Jun-2010 11:35

Progress.Lang.Object worked. That's more acceptable than direct inheritance because it should be implicit.

Thanks,

Posted by Admin on 01-Jun-2010 11:52

jquerijero schrieb:

Progress.Lang.Object worked. That's more acceptable than direct inheritance because it should be implicit.

Thanks,

That's generally speaking preferably. Inheriting from .NET has a price, both in performance and limiting ability to run that class on the AppServer - that's why my initial response was I'm glad that not every class in the ABL does inherit from System.Object.

There may be cases when the same event handler needs to be used from a non UI class and a UI class and then the event handler method needs to match a .NET delegates type signature, usually requirnig sender to be at least System.Object. Also when you need to pass an ABL class reference to a .NET object, the ABL object needs to inherit System.Object.

This thread is closed