>Is there a way to programmatically copy or move a class from one class library to another?
Either way, to copy it ADD CLASS.
Be careful here: If this is a class you instantiate with CREATEOBJECT() and you have a copy of the class in two different libraries, and issue SET CLASSLIB for both of them - so they're both in memory - a CREATEOBJECT() will use the one SET first. You can get around this by using NEWOBJECT() instead, which allows you specify the class library.
To move it, after ADD CLASS, REMOVE CLASS from the original library.
Be particularly careful here, because any classes derived from this class or form objects that are instances of this class will lose the reference to the parent class.
The only way, programmatically, to fix these is to hack each VCX (and SCX) containing a derived class or instance of the class and replace the
classloc
fields for those class or object records.
Insanity: Doing the same thing over and over and expecting different results.