In one of my old programe, I used a similar function to push the Unwanted columns in a preformated grid to set display order. This is very similar to your requiremnents. Hope you can get the idea from this.
*******************
I made the basegrid with
**
InitEvent
=========
WITH THIS
.SetAll("DynamicBackColor", ;
"IIF(recno(This.RecordSource)=THIS.inRecno, ;
RGB(0,255,0),RGB(255,255,192))","COLUMN"
&& Catch the input columnOrder in an array. This is used
&& to push columns with VISIBLE=.F. to the right of Grid.
&& Actual pushing is done in the Refresh Method.
IF .ColumnCount > 0
DECLARE .aColumnOrder(.ColumnCount,2)
For I = 1 TO .ColumnCount
.aColumnOrder(I,1) = .Columns(I).ColumnOrder
.aColumnOrder(I,2) = I
ENDFOR
=ASORT(.aColumnOrder)
ENDIF
ENDWITH
**EOF
***************************************
RefreshEvent
============
&& SET THE ORIGINAL COLUMN ORDER FIRST
&& AND ALSO SET THE NON VISIBLE COLUMNS TO THE LAST COLUMN
WITH THIS
IF .ColumnCount > 0
LOCAL lnNewOrder
lnNewOrder = 1
For I = 1 TO .ColumnCount
IF .Columns(.aColumnOrder(I,2)).Visible
.Columns(.aColumnOrder(I,2)).ColumnOrder = lnNewOrder
lnNewOrder = lnNewOrder + 1
ELSE
.Columns(.aColumnOrder(I,2)).ColumnOrder = .ColumnCount+1
ENDIF
ENDFOR
ENDIF
ENDWITH
**EOF
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.