Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to use CloneObject
Message
De
21/03/2011 12:50:08
Dragan Nedeljkovich
Now officially retired
Zrenjanin, Serbia
 
 
À
21/03/2011 12:26:32
Mike Yearwood
Toronto, Ontario, Canada
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire de projet
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Vista
Network:
Windows 2008 Server
Database:
Visual FoxPro
Application:
Desktop
Divers
Thread ID:
01503985
Message ID:
01504388
Vues:
55
>>Something like this
>>
MODIFY CLASS  (lcClassName) OF (lcLib)
>>aselobj(aa,1)
>>ox=aa[1]
>>cWindow=WONTOP()
>>with ox
>>	* do stuff here to your instance
>>endwith
>>ox.saveasclass(...)
>>* and now the nice part
>>ACTIVATE WINDOW (cWindow)
>>KEYBOARD '{CTRL+W}' PLAIN CLEAR
>>DOEVENTS FORCE
>>IF WEXIST(cWindow)
>>	RELEASE WINDOWS (cWindow)
>>ENDIF
>>
>>The manipulation of the editing window by wontop() and keyboarding makes this automatable - you can pass the lcLib as a parameter to your code, and it could use aVcxClasses() to extract class names from it, calling the above snippet one class at a time. The nice thing is that you can just erase the target classlib and run this again - should be done in a couple of seconds.
>
>That would only work for simple classes. It would take UE to NM, but classes composed of UE classes or forms built with UE classes would copy, but internal components would remain subclasses of UE.
>
>XX
>XY
>UE ------------------------------------> NM
>compound classes/forms ----> compound classes and forms

You'd have to do those in the next round, with a different builder, which would replace the undesired members with their clones, built from the new classes. Not hard to do - just recurse through the members, and wherever you find an Ukrainian (UE?), create a New Mexican (NM) object with identical properties (except name), removeobject the original, rename the clone, proceed to next Ukrainian, saveAsClass() to a new classlib when done.

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform