Advice on saving presets

I have a desktop app that will have a number of radio buttons, some text fields as preset names etc. There are “button features” that will contain a selection of buttons ( radio buttons on or off ) plus other values such as text fields ie a button feature name “my button feature 1”. Each preset will hold anywhere from 20 of these button features but needs to be scalable to include larger features later.

Here is a small example of a feature:

“my button feature name” Button feature name 1 of 20 possible for this preset
O Shift Key (radio button illustration)
O CMD key (radio button illustration)
000000 mouse position X ’ store a mouse position value
000000 mouse position Y ’ store a mouse position value
O Press Key Keycode = 1D ’ radio button that tells this button to press this key 1D

A PRESET will be a collection of a number of buttons ie 20 buttons that are on a remote panel. I want to save the functionality of each button to a folder as a Button Feature. I want to save a PRESET as a collection of the Button Features that are assigned to the buttons on the remote button panel. The Button Features will have a number of radio buttons and text and this options will increase over time.

Is this a job for XML or CSV? Is there an example somewhere that I can learn how to capture the button states ( true or false ) plus text and save it as a feature and the entire set as preset? Then recall the values back to the GUI?

Thanks for any suggestions.

Search this forum… there are dozens and dozens of topics about this, as well as dozens of alternative methods from Plist to INI like solutions

I have searched “save presets” “saving presets”, on google “saving presets xojo” and find not one conversation on it other than this thread. What keywords best suit this type of search?


plist, ini file, config

Ok thanks that helps.

I am trying to take the parts that someone wrote for me about 5 years ago or so that I used to same presets. I loaded the old RB file onto the Mac with the latest xojo, clicked resolve for all the issues. When I attempt to test or build, I get an error that

F = PreferencesFolder this item does not exist.

I grabbed only the top half of the code. Can someone please point in a direction to understand why this is not compiling on the new xojo and new computer? It worked fine on the older version on Mac 10.6.8.


[code] Dim f as FolderItem
dim Instream as TextInputStream
dim s as String
dim k as integer
dim pos1 as integer
dim pos2 as integer
dim exists as boolean
dim ID as string
dim pref as string

exists = false

if Filename <> “” then
f = PreferencesFolder.child(Filename)
if f.Exists then
’ read values from file
Instream = f.OpenAsTextFile
s = instream.ReadAll

what is the compiler telling you? with out knowing the error and location, it is difficult to provide any insight

Use SpecialFolder.Preferences instead.


This worked. Thanks!

Also see the Saving Preferences blog post.