Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Copying The Data Environment
Message
De
09/02/1999 22:41:12
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00185481
Message ID:
00185814
Vues:
25
>>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.
Erik Moore
Clientelligence
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform