Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Baseclasses not te be subclassed
Message
 
 
À
22/10/1998 06:34:47
Marco Beuk
Innovero Software Solutions
The Hague, Pays-Bas
Information générale
Forum:
Visual FoxPro
Catégorie:
Programmation Orientée Object
Divers
Thread ID:
00149269
Message ID:
00149628
Vues:
19
Marco,

>Example: when a user clicks a page in a pageframe i want its caption to turn bold so the user can see he/she has seen the page.
>I now have 'This.FontBold=.T.' in the Click() of all the applications pages (about 70 pages total). Now the user decided he/she doesn't want the page's caption to turn bold but red. Now i have to change the code at 70 places! This cannot be the goal of OOP.


You can use your subclassable container to addobjects that carry out your desired function at runtime. The PageRefresher class that my cPageFrame class adds to every page at Init time could easily be adapted to alter the display of it's .Parent object. You could add a couple of properties to your PageFrame class to contain addin object classnames and classlibs if you wanted.

>BTW: Optionbuttons can be subclassed, so can optiongroups. Subclassed optionbuttons cannot be used in a subclassed optiongroup!?!?!?!?

One way to deal with this is to design the visual aspects of your option group buttons, then at runtime use your optiongroup subclass Init() method to substitute your optionbuttons.

loButtonFormat = createobject( "optionbutton" )
for i = 1 to this.ButtonCount
   * copy this.Controls[i] properties to loButtonFormat
   lcName = this.Controls[i.Name
   .removeobject( lcName )
   .AddObject( lcName, "myoptionbutton" )
   loNew = eval( "this." + lcName )
   * copy properties from loButtonFormat to loNew
df (was a 10 time MVP)

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

Click here to load this message in the networking platform