Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
More Form q's
Message
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Title:
Miscellaneous
Thread ID:
00303139
Message ID:
00303493
Views:
18
>>You certainly can call a method from one form in another form wihtout a formset, you simply need a reference to the form that contains the method.
>You're right; i wasn't thinking it all the way thru... I guess I'm stuck on avoid 'global' variables at all cost -- I guess I'll just need to choke down and use them!

Josh,

There is no need to use public or global variables for this purpose. I absolutely detest public variables myself and NEVER use them.

The solution to this problem (referring to another form) can be handled in a nubmer of different ways. If a called fomr needs a refernce to its caller you can add a property to the called form named oCaller, in the Init put this code;

LPARAMETERS poCaller
Thisform.oCaller = poCaller

and then when you call the fomr do it this way;

DO FORM Whatever WITH Thisform

Now in the called form whenever you need to to refer to the calling form simply;

Thisform.oCaller.Whatever

That solves the problem of a sub form needing to refer to its creator. What about any form generally talking with any other form? Weel the first question to ask is why would this need to happen. The most common reason is the broadcast of a message to all open forms perhaps to tell them to refresh themselves or something like that. This is handled by using a form manager that launches and keeps a record of all forms launched. The fomr manager passes a reference to itself to each fomr and the forms store that refernce in a property. The form manager can have a broadcast method that would iterate through all open forms and send a message to them and the form that wants to broadcast a message would call the fomr manager and tell it what message to send.

This idea of a form manager is the basis for how most application frameworks on the market manage forms. The subject is complex and doesn't lend itself to exhaustive discussion in a message forum like this. There is a pretty good discussion of thes eissues in the book that Steve Sawyer and I wrote whihc you can get at www.hentzenwerke.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform