Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Programatically Determine List.ColumnWidths
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
01243619
Message ID:
01243823
Vues:
22
>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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform