>I'm in the process of upgrading / rewriting an old APP that was in FPW 2.6.
>This app has a load of screens which work as follows:
>
>ScreenA calls
> ScreenB calls
> ScreenC Calls
> ScreenD etc
>
>
>i.e. I have a screen which calls a screen which in turn calls another screen etc
>
>ScreenB, ScreenC and ScreenD will need access to variables that are created in ScreenA.
>In FPW , I did this by initializing Variables in the Screen Setup , and once this was done, they persisted locally for ScreenB,ScreenC and ScreenD also
>
>I'd welcome suggsetions on the best methof of doing this in VFP
>
>Regards
>
>Gerard
Gerard,
Pass form reference to called screens so they could access caller's PEM.
*ScreenB.Init
lparameters toForm, otherparmsifany
this.oCaller = toForm
* Any method in ScreenB
thisform.oCaller.AnyProperty = 'Value'
thisform.oCaller.AnyObject.Value = 'Value'
thisform.oCaller.AnyMethodEvent()
do form ScreenC with thisform.oCaller, thisform
*Provided types are compatible, not readonly etc
If Caller too would access to 'Called' PEM than either use :
oScreenB = createobject(...)
or :
do form ScreenB name thisform.CalledForms[n] linked
Caller could access called form's PEM then. CalledForms would be a custom array property.
Instead of passing form refs. another alternative is to pass a variables 'cargo' object. ie:
oCargo = createobject('Custom')
oCargo.Addproperty('FirstVar',thisform.SomeProperty)
*...
do form screenB with oCargo
ScreenB might change cargo content to pass values back.
PS: Since you're passing references be carefull about hanging obj. refs.
Cetin