Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Why don't ...
Message
De
27/04/1999 23:48:05
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Programmation Orientée Object
Titre:
Divers
Thread ID:
00212631
Message ID:
00212866
Vues:
22
>I just think this would make better sense, and be easier, to have this at the control level.
>

I think you are right that it would be better from a pure OO perspective to let the controls move themselves- but as Bob pointer out, we can't bind an external event to an object in VFP. My framework does the next best thing:

the textbox, label, checkbox, combo, and spinner classes all have two properties: FloatWithBottom and FloatWithRight. When set to true, these propetries make the control move with the bottom and the right sides of the form, respectively, when the form is resized. Grids and Editbox have ResizeWithBottom and RezizeWithRight properties that when checked cause them to resize with the bottom or right side of the form. Both of these actions are performed in Float and Resize methods in the objects.

Each control records its size and position relative to the bottom and right sides of the form in methods called from the control's init. These coordinates are stored in properties called stuff like: DistanceToFormBottom and DistanceToFormRight. The form's resize method contains code like:

THIS.LockScreen = .T.
FOR EACH oControl IN THIS
IF PEMSTATUS(oControl, 'Float',5)
oControl.Float()
ENDIF
IF PEMSTATUS(oControl, 'Resize',5)
oControl.Resize()
ENDIF
ENDFOR
THIS.LockScreen = .F.

So, in a way, the controls are handling it themselves; the only thing that the form is handling is notification of resize, which I don't think can be avoided. The form doesn't really know anything about its controls, it only has to check for the existence of the method to avoid errors. All of the logic for checking and storing position, and moving or resizing relative to that position lies in the conrols.
Erik Moore
Clientelligence
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform