Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Very basic form problem
Message
 
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00840010
Message ID:
00840045
Views:
15
Lisa,

>Yes, the variable is private not public. (It is most definitely created and, within the procedure, could be used to assign the reference elsewhere if you wanted.)

I guess I've always "examined" this from to late, ie outside the method execution.

* button.click()
do form pgftest1
pgftest1.BackColor = rgb(255,0,0)

this does in fact change the color of the form. I've never even thought to try something like this before. The NAME clause is in the do form command for a reason after all. *s*

This isn't formally documented behavior so I don't think I'd write a whole framework based on this short term exposure of the memvar. Although this is probably the root of why DO FORM from the command window creates the public memvar.

Consider this change to the button click method:

do form pgftest1
pgftest1.BackColor = rgb(255,0,0)
pgftest1.Caption = "first instance"

do form pgftest1
pgftest1.BackColor = rgb(0,255,0)
pgftest1.Caption = "second instance"

it does behave as expected. It looks like the DO FORM command early on detaches the first form from the memvar so that it can reuse it for the second instance.
df (was a 10 time MVP)

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

Click here to load this message in the networking platform