gettingstarted
[Top] [All Lists]

RE: Preferences

To: "'Getting Started'" <gettingstarted at lists dot realsoftware dot com>
Subject: RE: Preferences
From: "RBNUBE" <rbnube at mabenterprises dot com>
Date: Thu, 31 Mar 2005 08:14:06 -0500
Delivered-to: gettingstarted at lists dot realsoftware dot com
Importance: Normal
Keywords: rb-gettingstarted
>Using a dictionary to contain your  
>preferences, set all default values in the dictionary, read in  
>preferences from the file 

Which is what BPrefs does.  Someone else wrote one that uses the
Dictionary, too, but I can't remember who it was or where to get it.



-----Original Message-----
From: gettingstarted-bounces at lists dot realsoftware dot com
[mailto:gettingstarted-bounces at lists dot realsoftware dot com] On Behalf Of 
Seth
Willits
Sent: Thursday, March 31, 2005 12:05 AM
To: Getting Started
Subject: Re: Preferences


On Mar 30, 2005, at 8:04 PM, GAmoore at aol dot com wrote:

> and simply run each line through a loop : grab the first two digits,
> then run
> it through a sieve of if statements. If I add a new preference, just  
> put a
> new If statement - and it won't hurt earlier pref files.

There's no need to do that even. Using a dictionary to contain your  
preferences, set all default values in the dictionary, read in  
preferences from the file (I use a custom binary format that has proved

to work very well) and it sets values in the same dictionary. Then I  
just write the dictionary to disk. This is entirely forwards *and*  
backwards compatible. There's no need to write any code to add a new  
preference into the application at all other than setting it's default  
value. It's a piece of cake.




Seth Willits
------------------------------------------------------------------------

---
President and Head Developer of Freak Software - http://www.freaksw.com
REALbasic Guru at ResExcellence - http://www.resexcellence.com/realbasic

"Relations are simply a tedious pack of people, who haven't got the
  remotest knowledge of how to live, nor the smallest instinct about
when
  to die."
     -- Algernon, The Importance of Being Earnest
------------------------------------------------------------------------

---

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>


_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

<Prev in Thread] Current Thread [Next in Thread>