Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Question about handling Forms
Message
General information
Forum:
Visual FoxPro
Category:
Object Oriented Programming
Miscellaneous
Thread ID:
00191274
Message ID:
00407330
Views:
34
You could accomplish this same thing without modifying the DO FORM calls by using the _Screen.ActiveForm property. The ActiveForm property doesn't change its value to the new form, until the Activate event of the new form so it holds an object reference to the form that made the call.

The only caveat that needs to be added is that forms with some ActiveX controls could present a problem. The ActiveX control sometimes presents itself as the ActiveForm. A simple check of the BaseClass property to determine if _Screen.ActiveForm is a "Form" could be used before assigning the variable.

>In order to not go back to the command window, and assuming that forma calls formb, you could add a property to your forms called "oCallingForm".
>
>In the form's init put:
>
>
lparameters lCallingForm
>
>if pcount() > 0
>    ThisForm.oCallingForm = lCallingForm && Now you have a reference to
>                                         && the calling form.
>endif
>
>In the event that releases the current form, then put:
>
>if vartype( Thisform.oCallingForm) = "O"
>    ThisForm.oCallingForm.setfocus()
>endif
>
>ThisForm.release()
>
>Now, when calling this form from another one, let's say, through a button click, instead of simply do form..., do:
>
>do form xyz with ThisForm && That way the other form is aware of the
>                          && calling form and will set focus back to
>                          && it when you close it.
>
>
Larry Miller
MCSD
LWMiller3@verizon.net

Accumulate learning by study, understand what you learn by questioning. -- Mingjiao
Previous
Reply
Map
View

Click here to load this message in the networking platform