Welcome! Log In Create A New Profile

Advanced

Ericus: [WD21] Passing array between 2 windows

Posted by harvey68 
Ericus: [WD21] Passing array between 2 windows
September 08, 2018 07:18PM
Autor: Ericus

Link zum Beitrag: [27130.foren.mysnip.de]

Hi

In one page I have a small Structure defined as below.

STStores is Structure
StoreCode is string
Description is string
VCode is string
END
gstRecStores is STStores
garrStores is array of STStores

I fill with a few entries and all is fine. I want to pass this array to
a new window, where the number of entries in the array can be increased
or decreased.

How do I go about passing this array backwards and forwards between the
2 Windows? The way I am doing it now, the array, once received in the
1st window, has lost a bit of it's readability i.e. StoreCode on some
lines are suddenly empty.

Thanks in advance for your assistance.



Ericus Steyn
heinz kuebler: [WD21] Passing array between 2 windows
September 08, 2018 07:20PM
Autor: heinz kuebler

Link zum Beitrag: [27130.foren.mysnip.de]

Hi Ericus,


i used to do this with memory zones, works perfect.

not tried with arrays, but a simple solution would be to define the
array as global, so you need no passing back and forward

regards, Heinz
Ericus: [WD21] Passing array between 2 windows
September 08, 2018 07:21PM
Autor: Ericus

Link zum Beitrag: [27130.foren.mysnip.de]

Thanks Heinz

No idea what a memory zone is but will define the array as a global.
However I don't like to overload the global variables.

Thanks again



Ericus
Peter Holemans: [WD21] Passing array between 2 windows
September 08, 2018 07:21PM
Autor: Peter Holemans

Link zum Beitrag: [27130.foren.mysnip.de]

Hi Ericus,

Or you could have a class with global members.
The global declared members are shared between all instances of that
class.

Cheers,

Peter Holemans
Arie: [WD21] Passing array between 2 windows
September 08, 2018 07:22PM
Autor: Arie

Link zum Beitrag: [27130.foren.mysnip.de]

Ericus,

how is opening section of Window1 declared? I guess you have something
like

PROCEDURE Window1(LOCAL MyArray is array of STStores)

The LOCAL keyword is important here, otherwise you pass the array "by
reference" and as a result you will return it "to itself". Not sure if
that's allowed.
Re: Ericus: [WD21] Passing array between 2 windows
September 08, 2018 07:42PM
Hello Ericus,

You can pass arrays back and forth from windows to procedures just like any variable as long as they have the same names is the structure.

STStores is Structure
StoreCode is string
Description is string
VCode is string
END

garrStores is array of STStores

Open(Mywindow,garrStores)

//In the window accepting the array
//Build the structure with the same names of varibles
stWinStores is Structure
StoreCode is string
Description is string
VCode is string
END


MyWindow procedure(arrWinStores is array of stWinStores)

Or
You can declare the receiving window array as a varient and work with it that way.
//Using variant
MyWindow procedure(arrWinStores is variant)

I know this is a old post but I just figured this out recently and thought I would share.

DW
Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: