How to receive parameter back from class...

Posted by OctavioOlguin on 25-Feb-2017 15:45

I've learned a lot this week with just 4 or 5 post asking questions about .NET and OO.

I would like to close this week with a last discussion/lesson.

I've learned that the way to recover state fom object, is throug it's class' methods.  And this serve to figure out how to think of a class as if it were a persistent procedure, just waiting there and respondig to external events.

My question is as follows....

My class happens to have visual representation (it's a form) and blocking for user input,  I have resorted to the following:

1) to pass parameters to the internals of the class, when called the class, included the parameters in the calling.  Inside the class, defined PRIVATE VARIABLEs to hold the data passed in, and in the constructor of the class(which is the one who received parameters), simply copying the parameter value into the variables, as these are the ones that the methods inside the class will be able to access.

this is the constructor

CONSTRUCTOR PUBLIC BioLogin ( INPUT pCustNum AS INTEGER, INPUT pDate AS DATE ):        
        SUPER().
        InitializeComponent().
        THIS-OBJECT:ComponentsCollection:ADD(THIS-OBJECT:components).
        ASSIGN
            pCustomerNum     = pCustNum
            pDateOperation     = pDate. 
        
        CATCH e AS Progress.Lang.Error:
            UNDO, THROW e.
        END CATCH.
    END CONSTRUCTOR.

the pCustNum and pDate are then passed to pCustomerNum and pDateOperationto be reachable inside the methods of this class.

2) to get output parameters.... how could inform the calling procedure that this window made an action, or didn't???

These are my current questions about openedge OO

Thanks!

Posted by OctavioOlguin on 28-Feb-2017 17:45

Thanks Marian.. i'll check that!!!

.... scott....  Thanks!... i purchased the book when just came out!!! i'll revisit it!!!

All Replies

Posted by marian.edu on 26-Feb-2017 00:40

Octavio,


just because you’ve closed the form it doesn’t mean the instance is gone, you still have a reference to it inside the caller (unless you we’re quick to delete the object) so just use property/method access to find the info you need. If you want the caller to react to changes in that form while being displayed named events works fine (OO version of publish/subscribe).

Cheers

Marian Edu

Acorn IT 
+40 740 036 212

Posted by scott_auge on 26-Feb-2017 17:56

Download my book... it is pretty old, but will answer simple questions www.amduus.com/.../

Posted by OctavioOlguin on 28-Feb-2017 17:45

Thanks Marian.. i'll check that!!!

.... scott....  Thanks!... i purchased the book when just came out!!! i'll revisit it!!!

This thread is closed