Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Vfp50 - Saving the BROWSE field order
Message
De
08/04/1997 05:12:47
Jean-Pierre Overbeek
New Limit Database Solutions
Amsterdam, Pays-Bas
 
 
À
07/04/1997 08:33:46
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00027248
Message ID:
00027382
Vues:
21
>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
Fil
Voir

Click here to load this message in the networking platform