Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Controlling resize and anchoring
Message
De
20/01/2007 07:49:41
 
 
À
19/01/2007 09:05:58
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Versions des environnements
Visual FoxPro:
VFP 9 SP1
Divers
Thread ID:
01185929
Message ID:
01187319
Vues:
26
Finally found it here too...

I think you and others have one thing wrong in your understanding of anchoring:
if you programmatically set some left,top, height or width value, these values are not recalculated by the current Anchor setting of the control, but taken as they are. The Anchor setting only effects the values computed due to a form resize or a resize of the container containing the control.

So if you modify the anchor setting within some left, top, height or width assign it's already too late, the value passed in is already computed regarding the anchor value, setting the Anchor to 0 does not change the value of the parameter and it does not trigger a recalculation and a new assign.

Another important fact is, that there is some original anchor position and size foxpro remembers, when you set Anchor from 0 to some value>0.

So if you want a new position and size of a control to be it's new anchor position, you have no other choice as to set Anchor to 0 and back to the value wanted, as you don't have access to that original anchor position foxpro internally uses for calculating the position and size of controls due to interactive resizing of the form/container.

There are two things I found to be handy: To turn off anchoring temporarily I add a flag to the form, which I check in assign methods for left, top, height and width. If that flag is set, I simply reject the new value passed in, so controls are not repositioned and resized, as long as that flag is set on. If I then want further resizes to start from that new situation, I need the second mechanism, to reanchor controls. That is setting their Anchor property to 0 and back. This can also be done in that same assign methods after the new value is set (or not set). Or it can be done in an Anchor_Assign event, in which I do this setting to 0 and back, if the non usable Anchor value of -1 is passed in. I reject that -1 of course, but instead set Anchor to 0 and back.

Bye, Olaf.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform