From: Joel VanderWerf Date: 2006-05-30T06:25:36+09:00 Subject: Re: FXRuby - Howto remember some default settings as specified by the user ? Lyle Johnson wrote: > On 5/26/06, Nuralanur@aol.com wrote: > >> in an FXRuby GUI, I want to give the user many choices and I am >> searching for >> a way to let FXRuby remember these upon the next start of the GUI >> application. > > FOX's built-in registry stuff is probably the easiest choice to use. > It was a little disturbing to see so many responses that didn't point > out that option. Anyways, for more information, read this: > > http://www.fox-toolkit.com/registry.html > > Hope this helps, > > Lyle I gave up on FXRegistry and its parent FXSettings (and wrote the Preferences lib) because of the attached, from FXSettings.cpp. Note particularly the 2000 byte maximum on entry values. YAML is much more flexible. It handles the value parsing for you, which is a minor benefit for scalar types (numbers/booleans/strings/Times/etc) but especially nice if you have complex values, such as lists of things or hashes. With YAML, you can have hierarchical values, which are good for remembering settings on nested panes, or dependent dialog windows and their fields/panes. For a simple application these differences may not matter. OTOH, FXRegistry can put things in the Windows Registry if that's the way you want to go, for some reason. Also, if you need to interoperate with registry entries from C++ based Fox apps, FXRegistry is the only choice. Conversely, this will make it harder to interoperate with other ruby code that doesn't know about FXRuby. /* Notes: - Format for settings database file: [Section Key] EntryKey=string-with-no-spaces EntryKey="string\nwith a\nnewline in it\n" EntryKey=" string with leading and trailing spaces and \"embedded\" in it " EntryKey=string with no leading or trailing spaces - EntryKey may is of the form "ali baba", "ali-baba", "ali_baba", or "ali.baba". - Leading/trailing spaces are NOT part of the EntryKey. - FXSectionDict should go; FXSettings should simply derive from FXDict. - Escape sequences now allow octal (\377) as well as hex (\xff) codes. - EntryKey format should be like values. - Extensive error checking in unparseFile() to ensure no settings data is lost when disk is full. */ #define MAXBUFFER 2000 #define MAXNAME 200 #define MAXVALUE 2000 -- vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407