Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Updating a .vcx with a new version of a form

Status
Not open for further replies.

AndrewMozley

Programmer
Oct 15, 2005
623
GB
I am using a development system which keeps its vcx files in 2 locations. The planned approach is that you do your development in one location and then transfer it to another.

I have 2 libraries, chw1.vcx and chw2.vcx which were originally identical and contained one class (say) "andrew"

I have now edited chw2.vcx with an improved version of class andrew, and I have edited chw1.vcx so that it has several extra classes, "john", "sue" &c.

How can I update chw1.vcx so that it has the latest version of class andrew while retaining its extra classes of bill, sue &c?

As always, thanks in advance. Andrew M
 
syncing libs with more classes is not easy, if you don't know which class version is the newest one. And a class does not have a file datetime.

Your problem is one reason, why some vfp developers put only a single class into a vcx.

In general the approach is to have one single pository for the project and each developer of a team checks in and out the components he wants to modify or extend. There's CVS or Subversion for this.

That said the command needed to replace a class aClass from Some.vcx with Aclass of Another.vcx you do:

Code:
Add Class aClass of Another.vcx to Some.vcx Overwrite

Bye, Olaf.
 
>> How can I update chw1.vcx so that it has the latest version of class andrew while retaining its extra classes of bill, sue &c?

One way is to use the Class Browser.

First, back up your class libraries in case you mess it up!

Next, open two instances of the Class browser with the souce VCX in one, and the target it the other. Select the class you want to copy and then use CTRL+DRAG on the small icon above the treeview to move the class to the destination library. (You must use CTRL when you drag or else you will MOVE the class).
It's as easy as that.

You can also do it programmatically, see ADD CLASS, REMOVCE CLASS and RENAME CLASS commands in the help file for details (this is what the class browser uses...)



----
Andy Kramek
Visual FoxPro MVP
 
Thank you all for being so helpful. I take the general point expressed by Olaf and Mike that one needs to be careful with class libraries. I had in fact backed up both class libraries before I started to recover the latest version of all classes into chw1.vcx

I would mention that I have done very little work with the class browser, since I mainly modify existing forms. If there is any guide to the class browser with worked examples I would be grateful to be pointed towards it.

Olaf, I tried your method and it works. I'll make a note of that.

Andy. Thanks. The method you describe also works, and once one knows the technique, saved me keying in my rather verbose path names, so it is probably the more elegant way of working.

Mike. I appreciate that I had to do some work to restore the class, but by using Andy's drag and drop process the manual work was not too onerous. It was much less work than redesigning the form from scratch and using a cut and paste process on all the methods of the form in order to re-instate it. Maybe Source Control would have done the trick, but I am not familiar with that tool. It was really a matter of trying to recover from a situation in which I found myself.

But thank you again, everyone.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top