Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to refresh one form from another
Message
 
 
To
11/10/2005 17:38:43
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Environment versions
Visual FoxPro:
VFP 9
OS:
Windows XP SP1
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01058106
Message ID:
01058190
Views:
7
Antonio,

>Is it possible to execute refresh method of one form from another form?

If these two forms are regularly going to communicate with each other you should exchange an object reference because you can't be guaranteed that the memvar you and Victor were tossing around will always exist.

If you are spawning FormB from FormA and FormB needs to tell FormA to refresh:
* method that launches FormB
do form FormB with thisform
* FormB.Init()
lparameter loParentForm
this.oParentForm = loParentForm

* FormB.Destroy()
this.oParentForm = .null && clear the reference

* method where FormA needs refreshing
thisform.oParentForm.Refresh()
You can also use something like a Forms Manager object and let FormB request the manager to refresh the other form. You can use sys(2015) to create unique names for each form as they instantiate and use this name instead of holding hard object references.

You can use the _screen.Forms[] collection as another alternative to a full blown FormsManager object.
df (was a 10 time MVP)

df FoxPro website
FoxPro Wiki site online, editable knowledgebase
Previous
Reply
Map
View

Click here to load this message in the networking platform