MrFancyteeth
Programmer
morning
I'm trying to resize grid columns based on data that the cursor contains
step 1 is an Afields()
AFIELDS(arrfld,"curgrid")
FOR x=1 TO ALEN(arrfld,1)
cFld=arrfld(x,1)
IF arrfld(x,2)="C" && only for char fields
thisform.sizemycolumns(cfld,x)
endif
endfor
step 2 is the "sizemycolumns" form method which i pass the fieldname & an integer(x) which should be the column name
**** SIZEMYCOLUMNS Form Method
LPARAMETERS cFld,x
cexp="thisform.grid1.column" + ALLTRIM(STR(x))+".width"
cfld=ALLTRIM(cfld)
SELECT &cfld as fname,999999.999 as tlen FROM curgrid INTO cursor curlen GROUP BY &cfld readwrite
SELECT curlen
REPLACE curlen.tlen WITH thisform.TextWidth(ALLTRIM(curlen.fname))ALL
SELECT MAX(tlen) FROM curlen INTO ARRAY arrLen
&cexp=thisform.TextWidth(arrlen(1,1))
SELECT curlen
use
**** end of method
the error occurs in -
&cexp=thisform.TextWidth(arrlen(1,1))
I guess the macro substition of &cexp isn't liking having a numeric assigned to it.
anybody know a fix for this or another way of making the grid columns resize automatically?
mrF
I'm trying to resize grid columns based on data that the cursor contains
step 1 is an Afields()
AFIELDS(arrfld,"curgrid")
FOR x=1 TO ALEN(arrfld,1)
cFld=arrfld(x,1)
IF arrfld(x,2)="C" && only for char fields
thisform.sizemycolumns(cfld,x)
endif
endfor
step 2 is the "sizemycolumns" form method which i pass the fieldname & an integer(x) which should be the column name
**** SIZEMYCOLUMNS Form Method
LPARAMETERS cFld,x
cexp="thisform.grid1.column" + ALLTRIM(STR(x))+".width"
cfld=ALLTRIM(cfld)
SELECT &cfld as fname,999999.999 as tlen FROM curgrid INTO cursor curlen GROUP BY &cfld readwrite
SELECT curlen
REPLACE curlen.tlen WITH thisform.TextWidth(ALLTRIM(curlen.fname))ALL
SELECT MAX(tlen) FROM curlen INTO ARRAY arrLen
&cexp=thisform.TextWidth(arrlen(1,1))
SELECT curlen
use
**** end of method
the error occurs in -
&cexp=thisform.TextWidth(arrlen(1,1))
I guess the macro substition of &cexp isn't liking having a numeric assigned to it.
anybody know a fix for this or another way of making the grid columns resize automatically?
mrF