Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Programatically Determine List.ColumnWidths
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01243619
Message ID:
01243823
Views:
20
>Ok, I tried this, and I'm getting incorrect results.
>
>I have a cursor with 2 columns, ID and Caption. Their widths are 4 & 50.
>
>
>sColWidths = "0,"
>sFontName = .lstAssigned.FontName
>iFontSize = .lstAssigned.FontSize
>
>FOR iColumn = 1 TO FCOUNT()
>  iSize = TXTWIDTH(ALLTRIM(FIELD(iColumn)), sFontName, iFontSize)
>  sColWidths = sColWidths + TRANSFORM(CEILING(iSize)) + ","
>ENDFOR
>
>
>This results in sColWidths being "0,2,10,"
>

Did you check Help on TXTWIDTH function?

You may try to use
iSize = TXTWIDTH(replicate('O',fsize(FIELD(iColumn))), sFontName, iFontSize)
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform