Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Automatically size column widths in a grid
Message
From
11/09/2003 20:23:50
 
 
To
08/09/2003 07:15:49
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Miscellaneous
Thread ID:
00826986
Message ID:
00828373
Views:
15
Hi Marcia,

Thanks so much for the info! That did the trick!

Regards
Dennis

>Hello Dennis.
>
>Is there a way to automatically size column widths in a grid (probably in the Init event?)
>
>As the others have said, this is native in VFP 8. If you are using an earlier version, this code should help get you started.
>
>
>LOCAL lcFontStyle
>
>lcFontStyle = ''
>FOR EACH loColumn IN THis.Columns
>  *** Get the font style
>  WITH loColumn
>    lcFontStyle = lcFontStyle + IIF( .FontBold, 'B', '' )
>    lcFontStyle = lcFontStyle + IIF( .FontItalic, 'I', '' )
>    lcFontStyle = lcFontStyle + IIF( .FontOutline, 'O', '' )
>    lcFontStyle = lcFontStyle + IIF( .FontShadow, 'S', '' )
>    lcFontStyle = lcFontStyle + IIF( .FontUnderline, 'U', '' )
>
>    *** Set the width according to the underlying data
>    .Width = LEN( EVALUATE( .ControlSOurce ) ) * FONTMETRIC( 6, .FontName, .FontSize, lcFontStyle )
>  ENDWITH
>ENDFOR
>
Previous
Reply
Map
View

Click here to load this message in the networking platform