Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Resize control to field size in form designer
Message
De
09/12/1999 11:31:55
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00301020
Message ID:
00301057
Vues:
29
Having a bit of a tinker with the builder mechanism using the aselobj() function to populate an array from the form designer. I have missed out the builder parameters and the splitting of the control source etc. but this may do the trick.


LPARAMETER ...

LOCAL lnCount
LOCAL lnLength
LOCAL lnFieldWidth

*!* Create array of control names.
lnObjCount = aselobj(laSelected)

*!* A zero count indicates no objects selected.
if lnObjects > 0
for lnCount = 1 TO lnObjects
if laSelected[lnCount].BaseClass $ "textbox"
lcField = FieldFromControlSource()
lcAlias = AliasFromControlSource()

lnLength = fsize(lcField, lcAlias)

*!* Work out the width based on the current font.
lnFieldWidth = txtWidth(replicate("w", lnLength), ;
laSelected[lnCount].FontName, laSelected[lnCount].FontSize) * ;
fontmetric(6, laSelected[lnCount].FontName, laSelected ;
[lnCount].FontSize) + 2

laSelected[lnCount].Width = lnFieldWidth
endif
endfor
endif


Or something along those lines :-)
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform