Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to use CloneObject
Message
From
21/03/2011 12:26:32
Mike Yearwood
Toronto, Ontario, Canada
 
 
To
21/03/2011 11:20:54
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
General information
Forum:
Visual FoxPro
Category:
Project manager
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Vista
Network:
Windows 2008 Server
Database:
Visual FoxPro
Application:
Desktop
Miscellaneous
Thread ID:
01503985
Message ID:
01504380
Views:
64
>>I'm using MaxFrame, which is like a bunch of parts. When I build an application, I subclass VMP (XX) and make some extensions (XY used the parts to make an engine) and then an application specific set of classes (UE) and then I make the forms etc.
>>
>>Now when I go to start a new application, everything based on UE are not classes per se, but they have properties and methods that are likely to be set in the new application. I'd like to have the UE classes copied and renamed to NM and compound classes migrated from UE to NM - which Drew Speedie's (RIP) hacking tool can do. Then the forms (SCXs) would have to be migrated too.
>>
>>That would leave me the job of only changing existing properties instead of having to wade through the property sheets of all the subclasses to find the relatively few properties that must be set this far down the hierarchy.
>>
>>Explaining this and thinking about it over the last week or so, I want all components subclassed from XY (UE) and all components based on UE classes to be copied and mass hacked to NM.
>
>Can't you just write a builder which would instantiate each of your classes, and then aSelObj() the instance and then .SaveAsClass() it to where you want it, with a name you like?
>
>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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform