General information
Category:
Forms & Form designer
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 :-)
Previous
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only