Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Scope of a form's Property Value
Message
From
25/08/2002 08:32:09
Carmen Gassi
Perseus Software Systems
Oakville, Ontario, Canada
 
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00693357
Message ID:
00693401
Views:
21
Hi Jim
Thanks for the explanation. I have changed my code accordingly, your idea makes a lot of sense and works perfectly.

Regards,
Carmen
>Carmen,
>
>Be careful when using the form object's name like that. You have no guarantee that the form's name will be what you think it is.
>
>If a child form needs to deal with a parent form's properties then that child form should be created from code within the parent form. This is just good programming to keep the dependant form under the complete control of the "owner" form. Once you do this it is easy to send the object reference when the child form is run. In the parent form's code that runs the child do this;
>
>
>* Some code somehwere inside of the parent form
>DO FORM ChildForm WITH Thisform && this sends the Thisform reference to the child as an argument
>
>
>Now in your child form add a property named oParentForm using the Form menu in the form designer. Also add this code to the child form's Init method;
>
>
>* Child form's Init
>LPARAMETERS poParentForm
>Thisform.oParentForm = poParentForm
>
>
>Now whenever, in the child form, you want to access a property of the parent form you can ...
>
>
>Thisform.oParentform.SomePropertyName
>
>
>And there is no dependance on any form object names, the code is generic. This means that your child form could be called by a number of different parent forms and it will always address the form that called it.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform