Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Size of columns in a grid
Message
 
 
To
01/06/1999 16:57:24
Koos Veel
Gamma Research
Aruba
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00225118
Message ID:
00225327
Views:
11
I approach this problem by setting up an auxiliary formatting table containing the fields: FieldName, RealName, FieldSize. FieldName is the actual cursor field name, RealName is the name I want to see in the grid display.

I set the grid formatting properties by scanning through the formatting table, as show below.

* Format grdGrid Headings
THIS.PARENT.grdGrid.SETALL("FontName", "Arial", "Header")
THIS.PARENT.grdGrid.SETALL("FontSize", 8, "Header")
THIS.PARENT.grdGrid.SETALL("FontBold", .T., "Header")
THIS.PARENT.grdGrid.SETALL("FontCondense", .T., "Header")

nScaleMult = 8 && to match the font size

nFieldNum = 0
* Format the grid data.
SCAN
nFieldNum = nFieldNum + 1
* Get the caption for the grid column.
cUsedName = ALLTRIM(IIF(EMPTY(RealName),FieldName,RealName))
THIS.PARENT.grdGrid.COLUMNS(nFieldNum).Header1.CAPTION = UPPER(cUsedName)

* Make the field size the larger of the field size or the caption length, but no less than 30.
nFieldLength = MIN(FieldSize,30)
nCaptionLength = LEN(cUsedName)
THIS.PARENT.grdGrid.COLUMNS(nFieldNum).WIDTH = MAX(nFieldLength,nCaptionLength) * nScaleMult
ENDSCAN


My Show Me The Code Web Site


Previous
Reply
Map
View

Click here to load this message in the networking platform