Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
.ini files
Message
De
31/10/1998 11:14:43
 
 
À
31/10/1998 10:21:13
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Titre:
Divers
Thread ID:
00150938
Message ID:
00153169
Vues:
33
>>That's cool. It sounds like that would be good for general system variables, but I don't think it would be good for saving the grid settings. I don't want a bunch of variables for that.
>>
>>Thanks,
>>
>>-Michelle
>
>It doesn't seem like a bunch of variables if you have everything in an array. I'm convinced that a simple array would be enough to store all grid settings. For example:
*After user made his/her prefferences
>DIMENSION gaGrid[1]
>FOR i=1 TO Thisform.Grid.ColumnCount
>   gaGrid[i] = Thisform.Grid.Columns(i).Width
>ENDFOR
>SAVE TO < UserID >.MEM ALL LIKE gaGrid*
>********
>* Grid.Init()
>RESTORE FROM < UserID >.MEM
>FOR i=1 TO This.ColumnCount
>   This.Columns(i).Width = gaGrid[i]
>ENDFOR

Good point, but I tend to use SAVE TO MEMO for something like that;  it allows you to have a table with user preferences.  Rather than a .MEM file per user, you could have a table with grid preferences.  A simple example;  imagine a table GridPref with a UserID C(??), a GridID I, and a memo field GridSets.  To take your example a step further.  NB.  This is greatly oversimplified.

<pre>
* Grid.Init()
* 
SELECT GridPref
LOCATE FOR UserID = cMyCurrentUserID AND GridID = this.iGridIDKey
IF FOUND()
   RESTORE FROM MEMO GridSets ADDITIVE
   *  And use the restored arrays to set your grid;  all start with iaGrid
   RELEASE ALL LIKE iaGrid*
ELSE
   *  The user never has been here, so he doesn't have a pref saved
ENDIF

*  Grid.Release()
*
SELECT GridPref
LOCATE FOR UserID = cMyCurrentUserID AND GridID = this.iGridIDKey
IF ! FOUND()
   INSERT INTO GridPref VALUES (cMyCurrentUserID, this.iGridIDKey)
ENDIF
* Save your settings to arrays starting with iaGrid
SAVE TO MEMO GridSets ALL LIKE iaGrid*
This provides a starting point for a general mechanism for saving your preferences and restoring them, without having to save lots of individual files and coming up with a complex .MEM file naming scheme.
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform