Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
What is the easiest way to duplicate a class in a VCX
Message
 
 
À
11/12/2008 16:50:42
Mike Sue-Ping
Cambridge, Ontario, Canada
Information générale
Forum:
Visual FoxPro
Catégorie:
Classes - VCX
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP2
Database:
Visual FoxPro
Application:
Desktop
Divers
Thread ID:
01366733
Message ID:
01366798
Vues:
9
Mike,

So what's relevant and reuseable should go into the class, then your two cbos should be subclasses of the newly created class. Think of this as a chance to refactor/refine your class design.

Let's call cboX your existing class you want to copy to cboY in this operation and assume it's based on a root level subclass of the VFP classes so there is this current hierarchy:
ComboBox
   cboBase && isolates you from VFP baseclass changes and you fix what's wrong with the VFP baseclass here
      cboX && some reuseable good code exists here now
You should consider doing this
ComboBox
   cboBase && move anything  from cboX to here that is useful in EVERY cbo you will ever use
      cboLevel1 && bad name... but move any cboX stuff that is useful to this subset of cbos here
         cboX && changed to derive from cboLevel1 the only code that remains here is specific to this instance of the class
         cboY && new instance of the class you are wanting to start this copy operation
>I understand what you are saying and perhaps I have a bad class design, but, I really do want to copy the class as a starting point. I'm going to remove a lot of the existing properties and methods and add to it. Rather than trying to retype all that stuff, I figured it would be easier to copy it, delete the unnecessary parts, then go from there.
df (was a 10 time MVP)

df FoxPro website
FoxPro Wiki site online, editable knowledgebase
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform