Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Grid Preferences/Set up not staying
Message
 
 
À
15/10/1999 14:23:25
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00277024
Message ID:
00277785
Vues:
23
>How do you set it up so that if the user splits the grid or moves columns in a paricular order it stays? Each time a new selection is made from the 'main' form, the grid goes back to the way it was originally.

The memento design pattern could be useful here: the memento design pattern is used when you need to capture a "state" within an object for later restoration.

For instance, here is a class that captures the current alias setting:

SELECT MyDBF1
loAlias=CREATEOBJECT("AliasMemento")
loAlias.GetState() && Captures state (alias)
SELECT MyDBF2
loAlias.SetState() && Restores state (alias)

DEFINE CLASS AliasMemento AS LINE
cAlias = ""

PROC GetState
this.cAlias = ALIAS()
ENDPROC

PROC SetState
SELECT (this.cAlias)
ENDDEFINE

You could create an class that loops through the column collection of a grid, storing the state (width, order, etc) of the columns within a memento object. Instantiate and fill in the memento when the form is instaniated, and then in the GotFocus of the form, restore the grid from memento.

Hope this helps,
Rick
Rick Hodder
MCP Visual Foxpro
C#, VB.NET Developer
Independent Consultant
www.RickHodder.com
MyBlog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform