Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
.ini files
Message
De
31/10/1998 11:35:26
 
 
À
31/10/1998 11:24:24
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Titre:
Divers
Thread ID:
00150938
Message ID:
00153175
Vues:
34
>>>>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.
>>
>>
>>* 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.
>
>I totaly get your point, Ed. However, the whole point here as far as I'm concerned is to avoid use of tables to keep user prefferences. Michelle might do that in this particular case, as it's not that much, but I always assume that user's will desire more and more prefferences to be saved, and I'm usually right. Therefore I use a combination of .mem files and WinRegistry (specially this).

This is just as flexible as a .MEM file; you don't have individual fields, just a single memo field that you save preference-related arrays to and from. YMMV. The registry really isn't an appropriate place to save Grid Preferences unless you save them relative to HKEY_CURRENT_USER and implement roaming profiles. This doesn't addrss the issue of exactly what sort of registry values would be used to save preferences (REG_MULTI_SZ or REG_BINARY would be most flexible, but are a bit of a pain to mainpulate in VFP.) With multiple users and grids, directory bloat can and does become a problem quickly - a system with 30 grids and 30 users would have 900 .MEM files to save all the preferences, with no advantage (at least to me) over having a GridPref table with 3 files (.DBF, .FPT and .CDX), with each record capable of acting in exactly the same way that a .MEM would act. You could still have grid-specific behaviors, and just change the grid instance's Init() and Release() methods.
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
Répondre
Fil
Voir

Click here to load this message in the networking platform