Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Copying The Data Environment
Message
 
To
09/02/1999 22:41:12
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00185481
Message ID:
00186011
Views:
24
>>>Probably you want to copy the whole record, anyway, like:
* The one to get the new DataEnvironment
>>>USE MyForm1.scx
>>>* The one with the DataEnvironment you want in both
>>>USE MyForm2.scx IN 0
>>>* Get the right record (should be record # 2)
>>>LOCATE FOR [base]class="dataenvironment"
>>>FOR FldNum = 1 TO FCOUNT()
>>>	REPLACE ( FIELD(m.FldNum) ) WITH ("MyForm2." + FIELD(m.FldNum) )
>>>ENDFOR
>>>USE IN MyForm2
>>>USE IN MyForm1
HTH,
>>
>>P.S. - would a DELETE MyForm1's record then APPEND it from MyForm2 work? Or will Form Designer crash if you open a form and the DataEnvironment record isn't record # 2?
>>
>>Thanks,
>
>Whoa- wait a minute here guys. The above will surely replace one form's dataenvironment object with another form's, but it won't do anything for the cursor objects.
>
>SCX files work like this: Each record represents an object. Each record (except for the form itself) also references a parent object with its Parent property. Since DEs are their own object, and each cursor is its own object, to completely copy a form's DE from one scx to another, you would not only need to copy the DE object, but also each contained cursor.
>
>I don't know this for sure because I haven't tested it, but I would guess that VFP might get a little freaked out if the DE object wasn't the second record in the scx (it always is when VFP writes the scx). Also be careful that the form object is the first object after the last cursor in the DE.

My mistake, naturally you'd have to copy all the table/cursor/view records associated with the DataEnvironment. I guess I just exposed the fact that I've never actually used the DataEnvironment of a form. So far I'm still relying on tables being opened by my startup app the way I did in FPW.
Rich Addison, Micro Vane, Inc., Kalamazoo, MI
Relax, don't worry, have a homebrew.
- Charlie Papazian, The New Complete Joy of Home Brewing
Previous
Reply
Map
View

Click here to load this message in the networking platform