Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Thoughts on a Screen calling a screen calling a screen
Message
From
01/05/2002 06:22:39
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00651233
Message ID:
00651240
Views:
21
>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
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform