Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Size of columns in a grid
Message
 
À
01/06/1999 16:57:24
Koos Veel
Gamma Research
Aruba
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00225118
Message ID:
00225327
Vues:
10
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


Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform