Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Best way to save column order?
Message
 
À
01/04/1997 16:43:25
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00026428
Message ID:
00026570
Vues:
28
I've set it up and it works great. I subclassed a grid added a couple of properties and added the following code to the init and destroy: Does anyone see any problems with this code, or a better way to do it?

GRID.INIT()
LOCAL lcPref
IF this.AutoRestore = .T. AND !EMPTY(this.PrefTableName)
lcPref = this.PrefTableName
SELECT &lcPref
SET order to id
FOR x= 1 to this.ColumnCount
IF seek(thisform.name+this.Name+this.Columns(x).Name)
IF colord<>this.Columns(x).ColumnOrder
this.Columns(x).ColumnOrder = colord
ENDIF
ENDIF
ENDFOR
ENDIF

GRID.DESTROY()
LOCAL lcPref
IF this.AutoRestore = .T. AND !EMPTY(this.PrefTableName)
lcPref = this.PrefTableName
SELECT &lcPref
SET order to id
FOR x= 1 to this.ColumnCount
IF seek(thisform.name+this.Name+this.Columns(x).Name)
IF colord<>this.Columns(x).ColumnOrder
REPLACE colord with this.Columns(x).ColumnOrder
ENDIF
ELSE
APPEND blank
REPLACE frmName with thisform.Name
REPLACE grdName with this.Name
REPLACE colName with this.Columns(x).Name
REPLACE colord with this.Columns(x).ColumnOrder
ENDIF
ENDFOR
ENDIF


>>I thought it might be a neat feature for the user to be able to move grid
>
>>columns around to their liking and then the next time they started that
>>form, the grid would keep that order. Does anyone have any suggestions on
>
>>the best way to store/retrieve this info?
>
>I have a table that hold user prefernce for form positions etc.
>you can use soomething similar for grids
>you can also use INI or the registry or whatever - but I thing tables are
>best as VFP handles them so good :)
>
>Arnon

Michael G. Emmons
memmons@nc.rr.com
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform