Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Programatically Determine List.ColumnWidths
Message
 
To
25/07/2007 20:37:55
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01243619
Message ID:
01243821
Views:
26
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,"






>>I need to load a list box in a SCAN/ENDSCAN.
>>
>>Some columns may or may not be visible, so I want to set the ColumnWidths property
>>from the data.
>>
>>How do I calculate the ListBox ColumnWidth? I could use FONTMETRIC(6,,) * FSIZE(), but that
>>would result in some really wide columns in the listbox.
>
>You could calculate max(txtwidth(alltrim(yourfield), listbox.fontname, listbox.fontsize, "N"), that would give you a pretty good estimate. Add a few pixels for margin.
Everything makes sense in someone's mind
public class SystemCrasher :ICrashable
In addition, an integer field is not for irrational people
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform