Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
'NAME' clause of DO FORM
Message
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00134714
Message ID:
00134798
Views:
17
Joe,

If two objects are going to communicate with each other it's usually better to have them pass references to themseleves:

do form second with thisform

then in the second form you have something like:

procedure Init
lparameter roCallingForm

this.oCallingForm = roCallingForm
this.oCallingForm.BackColor = 255

procedure Destroy
this.oCallingForm.TellYouIAmDone()
this.oCallingForm = .null.


rather than rely on static names of memvars or properties. This allows a much more flexible architecture and easily handles multiple instances of forms.

You can also use a Mediator object to establish communication between objects. The Mediator could use the _screen.Forms[] collection to find

>I have a form that I start up with
>DO FORM blah NAME blahhandle
>
>Now while I'm in another form, I can reference 'blah's properties and such by looking at 'blahhandle.property'
>
>Ok, so far so good...
>
>Now I call another form while the first form is open, again using the NAME clause (with a different name) and I CAN NOT REFERENCE that new name!
>
>DO FORM second NAME sechandle
>
>MY second form pops open, but the object 'sechandle' IS NOT defined
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