Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Share objects between forms
Message
From
03/03/2000 16:15:38
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
03/03/2000 16:06:02
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Miscellaneous
Thread ID:
00341441
Message ID:
00341501
Views:
25
>>
Launch the form with a name clause.
>>
>>do form form1 name "FirstForm"
>>do form form2 name "SecondForm"
>>
>>*SecondForm.AnyMethod
>>FirstForm.AnyPEM
>>
>>It's better you assign variables to names and keep them somewhere which each new form could access (oApp custom application, _screen etc or public ).
>>Cetin
>
>This sounds very good. I made a workaround which I did not expect to work: I send the property (the reference to the object) as parameter to the other form. There I also use a property which holds the object which was sent as the parameter to the INIT(). When I make changes to the object from the called form, the changes will also be in effect in the original form's property, because the property seems just to point to the object.
>
>Can you explain why this works? I expected that the changes were not visible backwards, unless I would send the parameter by reference.
>However, I'm happy that this works, although your solution is much more professional.
>
>Christian


Christian,
As long as you pass object ref all would work. If you mean you need that between only these forms then you could simply do :

do form myForm

* myForm.SomeMethod
do form AnotherForm with thisform && Send form obj ref

*AnotherForm.Init
lparameters toObject
this.oCaller = toObject && Save caller's ref to a custom proerty

*AnotherForm.AnyPEM
this.Anyproperty = thisform.oCaller.AnyObject.AnyProperty
thisform.oCaller.AnyObject.AnyProperty = thisform.AnyPEM
thisform.oCaller.AnyObject.AnyEventMethod(this.SomeProperty)

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
Reply
Map
View

Click here to load this message in the networking platform