Dear All:
I reviewed part of the thread here mentioning Grid's AutoFit function.
To my understanding, that grid.autofit would fit column's width accordingly to current displaying records.....
It is hard to explain. anyway, here is little coding for your reference in grid.init for your comment and correction:
I reviewed part of the thread here mentioning Grid's AutoFit function.
To my understanding, that grid.autofit would fit column's width accordingly to current displaying records.....
It is hard to explain. anyway, here is little coding for your reference in grid.init for your comment and correction:
Code:
** SCAN ALL RECORDS TO FIND MAX WIDTH OF COLUMN
LOCAL laWidth(FCOUNT()) as Number
FOR nCount = 1 TO FCOUNT()
laWidth(nCount) = 1
ENDFOR
nRowNumber = FLOOR(((this.Height - this.HeaderHeight) / this.RowHeight ))
nPages = CEILING(RECCOUNT() / nRowNumber)
thisform.LockScreen = .T.
GO TOP
this.AutoFit
this.Refresh
FOR nCount = 1 TO nPages
IF EOF()
GO bottom
SKIP -nRowNumber + 1
ENDIF
this.Autofit
this.Refresh
FOR nCount2 = 1 TO FCOUNT()
laWidth(nCount2) = MAX(laWidth(nCount2), this.Columns(nCount2).Width)
ENDFOR
SKIP nRowNumber
ENDFOR
FOR nCount2 = 1 TO FCOUNT()
this.Columns(nCount2).Width = laWidth(nCount2)
ENDFOR
GO top
this.refresh
THISFORM.LockScreen = .F.