input-output temptable for window to form

Posted by bart.syryn on 29-Jun-2017 03:20

Hi, I'm new in developing gui for .net, so still learning. I have a 'window' .W and would like to pass and return a temp-table to a form. The form has a grid and a bindingsource where I fill a dataset with the temp-table I recieved in the constructor. I can display the data in a grid. I can change the data of the temp-table in the grid. But I really haven't find a method to pass the changed data in the temp-table back to the .w Window. Find many examples, but nothings works.. Seems such a simple thing, I didn't expect, that it could be so difficult....

Posted by bart.syryn on 30-Jun-2017 01:34

Hi Mark,

Thanks for replying.

I've implemented your first option.

I tried the second one, but problem is that I pass the temp-tables to the constructor. I wasn't able to create the 'instance' to access a method from a progress window. Cause was that declaring the instance with the temp-tables.

DEFINE PUBLIC STATIC PROPERTY instance AS CLASS dgsoortstrijkNO-UNDO

 GET():

     IF instance = ? THEN instance = NEW dgsoortstrijk().

     RETURN instance.

 END GET.

PRIVATE SET.

...

CONSTRUCTOR PUBLIC dgsoortstrijkvolgorde(INPUT P_windowhandle AS HANDLE, INPUT-OUTPUT TABLE tt-typestrijk BIND, INPUT-OUTPUT TABLE tt-soortstrijk BIND):

.....

Regards

Bart

All Replies

Posted by Mark Davies on 29-Jun-2017 03:53

Hi,

You have two options - depending on how you want to approach this.

You will need to pass the handle of the window - you are looking for the persistent handle to the window (THIS-PROCEDURE) in your Form class - perhaps pass it in via the constructor as you are doing with your temp-table. This way, you can run an internal procedure available in your window from the class and just pass the temp-table with changes back - using the standard RUN <procedure> IN <proc handle> (<params>).

The alternative is to call a method in your Form class from your window (.w) as you will have the object instance to the form class you launched. So. if your form has an OK button that also closes the Form and exists the WAIT-FOR (and I am assuming your WAIT-FOR to launch the FORM is doing so with a ShowDialog() ) then it will close the FORM, but the instance to it is still available and this gives you an opportunity to call methods or retrieve values for its properties still before you destroy it.

....

WAIT-FOR oMyForm:ShowDialog().

oMyForm:SomeMethodInTheForm(<params>).

....

Hope that helps

Posted by bart.syryn on 30-Jun-2017 01:34

Hi Mark,

Thanks for replying.

I've implemented your first option.

I tried the second one, but problem is that I pass the temp-tables to the constructor. I wasn't able to create the 'instance' to access a method from a progress window. Cause was that declaring the instance with the temp-tables.

DEFINE PUBLIC STATIC PROPERTY instance AS CLASS dgsoortstrijkNO-UNDO

 GET():

     IF instance = ? THEN instance = NEW dgsoortstrijk().

     RETURN instance.

 END GET.

PRIVATE SET.

...

CONSTRUCTOR PUBLIC dgsoortstrijkvolgorde(INPUT P_windowhandle AS HANDLE, INPUT-OUTPUT TABLE tt-typestrijk BIND, INPUT-OUTPUT TABLE tt-soortstrijk BIND):

.....

Regards

Bart

This thread is closed