Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
NEWOBJECT() Has no parent.
Message
De
29/06/2000 11:18:14
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Classes - VCX
Divers
Thread ID:
00384767
Message ID:
00386477
Vues:
36
Hi David,

I actually use my object in a few other objects - labels, buttons, textbox, optiongroups, etc., and it's really cool, because I can put all sorts of neat logic into it very generically. For example, if the button gets too small, I can resize the font.

You could still do this all with the resize method, but the great thing about putting it into a single object is if I decide to change the behavior, I only need to do it once, rather than in each class.

This was my first foray into true OOP design, inspired by Marcus Egger's book. In retrospect, it might have been easier to do by writing code in my baseclasses, but not that I have it working, it really is awesome. I never need to worry about resizing anything! It just does it. And a couple of on/off toggles allow me to control all sorts of neat features (i.e. allow font size change).

***********


David,

I only have 4 resizeable subclasses (grid, editbox, listbox and pageframe). These are the only ones that make sense to me to have resizeable, as such I decided to put the intelligence in the Resize() method of these subclasses themselves. For my resizeable forms the Resize() message just gets broadcast to the contained objects.

This seems easier to me than using a separate resizing observer object.

>What do you do about a class that's not a container class, and doesn't have an addobject method? I ran into a similar problem a while back - I created a sizing object which automatically handles resizing of any object which has a reference to it when it or it's container is resized. In order to do it, I had to pass the "parent" class' object reference to the resize object. To solve the dangling reference problem, I use the same name for this object in all my classes, and in all my base container classes, I created a "custom event" which triggers all the cotained classes to kill the autoresize object reference.
>
>Sounds complicated, and it was, but now that it works in all my baseclasses, I never have to worry about it. Is there a better way to do that?
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform