>If I am using a browse in my program and when I am
>viewing the browse, I want to put the fields in a different order, can I save this new order?
Hello Robert,
Here is my solution:
Create a table GRID: Name C(20),Propertie C(20),SETTING M()
And an index on Name+Propertie
*** Add this to the INIT of your grid
IF !SELECT("GRID")>0
IF FILE("GRID.DBF")
USE GRID IN 0 ORDER 1
ENDIF
ENDIF
IF SELECT("GRID")>0
SELECT GRID
SET KEY TO LEFT(This.Name+SPACE(100),LEN(Grid.Name))
GOTO TOP
SCAN
IF OCCURS("|",Grid.Setting)=This.ColumnCount
h_setting=Grid.Setting
FOR h_column=1 TO This.ColumnCount
h_propertie="This.Columns("+ALLTRIM(STR(h_column))+")."+ALLTRIM(Grid.Propertie)
h_val=LEFT(h_setting,AT("|",h_setting)-1)
&h_Propertie=VAL(h_val)
h_setting=SUBSTR(h_setting+" ",AT("|",h_setting)+1)
NEXT
ELSE
h_propertie="This."+ALLTRIM(Grid.Propertie)
&h_propertie=VAL(Grid.Setting)
ENDIF
ENDSCAN
ENDIF
*** Add this to the DESTROY of your grid
IF SELECT("GRID")>0
*** ColumnOrder
h_setting=""
FOR h_column=1 TO This.ColumnCount
h_setting=h_setting+ALLTRIM(STR(This.Columns(h_column).ColumnOrder))+"|"
NEXT
IF !SEEK(LEFT(This.Name+SPACE(100),LEN(Grid.Name))+"ColumnOrder","Grid")
INSERT INTO GRID (Name,Propertie,Setting) VALUES (This.Name,"ColumnOrder",h_setting)
ELSE
REPLACE Grid.Setting WITH h_setting
ENDIF
ENDIF
This saves and restore the column order. You can add other properties also, but I think Column order is most essential.
Greetings,
Jean-Pierre
Précédent
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement