Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Grid Preferences/Set up not staying
Message
From
18/10/1999 21:09:19
 
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00277024
Message ID:
00277963
Views:
17
Thanks Rick. I actually think I understand what you're saying :-)


>>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
"Live Well, Laugh Often, Love Much..."
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform