First of all, I consider myself a Xojo newbie - I did some RB development a long time ago but haven’t done anything with Xojo so I’m severely “out of touch”. Anyway, I want to build a few programs for my own use and I’m looking for different components:
Saving “preference files” and/or document files. I used to have my own framework for this that saved any kind of data into a binary file but it’s gone … and there should be better way to do it. What is the recommended way to store info today? plist files, XML, json … something else? Are there any ready made classes that makes it easier do to? (For example, I think that there used to be some class(es) for using the plist format.)
Date/calendar controls. It looks like these are still missing. I used to use Einhugurs plugins for this and I see that they are still around. Are they still a good alternative? Something else?
Exif info - is there some library that allows me to read exif/iptc info without having to code it myself.
There are many discussions on this forum about “preference” files, and everyone has their own “preference”… I personally created class that uses a format similar to the windows INI file. It works cross platform. Others here will indicate they like any one of a number of things, including all the ones you mentioned.
Date/Calendar, again discussed over and over… Einhugar has some, Mike Cotrone also has one that seems to be quite popular.
MBS has a few plugins which will allow you to read/write exif data. I’ve been using the ImageMagick library plugin for this and a number of other useful features. It’s cross platform and fairly easy to understand.
Is this documented somewhere, I checked the manual for the ImageMagick plugin (“MBS ImageMagick Plugin.pdf”) but the only reference I could find to exif was how to compile a PHP library.
Using the “proper” form on each platform isn’t that hard
And IF you want proper system caching etc of preferences then DO NOT WRITE YOUR OWN !
This is true on OS X.
OS X uses a daemon that does cache certain values so if you use a preferences pane etc or use defaults write to change a preference it gets properly cached, conveyed to your app, etc.
And its easy enough to write a set of classes, one for OS X, one for Windows, one for Linux that all implement an interface that you can then use generically and get a proper CFPreferences form on OS X, registry entries (or ini file if you want) on Windows, & something else on Linux (maybe an ini form or not)
The IDE actually does it this way and from the outside there is one set of preferences that it uses and doesn’t care what the underlying representation is.
The skeleton we use is like
Module Preferences
private sub read()
if mPreferencesProvider is nil then mPreferencesProvider = GetProvider
mPreferencesProvider.Read
end sub
private sub write()
if mPreferencesProvider <> nil then mPreferencesProvider.Write
end sub
private sub GetProvider()
#if targetmacos
return new macPrefsProvider
#elseif targetwindows
return new winPrefsProvider
#elseif targellinux
return new linPrefsProvider
#endif
end sub
private interface PreferencesProvider
sub read()
sub write()
sub readBoolean(name as string, defaultValue as boolean)
sub writeBoolean(name as string, alue as boolean)
// ... etc for whatever types you need - strings , integers, arrays of items etc
end interface
private class macPrefsProvider implements PreferencesProvider
sub read()
// declares / macoslib or MBS code to read CFpreferences (usuall just need to open them)
end sub
sub write()
// declares / macoslib or MBS code to write CFpreferences (usually if they are dirty)
end sub
sub readBoolean(name as string, defaultValue as boolean)
sub writeBoolean(name as string, alue as boolean)
private property CFPreferencesHandles as integer
end class
private class winPrefsProvider implements PreferencesProvider
sub read()
sub write()
sub readBoolean(name as string, defaultValue as boolean)
// xojo / declares / WFS or MBS code to READ REGISTRY value & return it
sub writeBoolean(name as string, alue as boolean)
// xojo / declares / WFS or MBS code to write REGISTRY (usually if they are dirty)
end class
private class linPrefsProvider implements PreferencesProvider
sub read()
sub write()
sub readBoolean(name as string, defaultValue as boolean)
sub writeBoolean(name as string, alue as boolean)
end class
all “preferences” then go through the module - ie we have a navigator font size preference like
Integer NavigatorFontSize
Get
return prefs.ReadInteger("NavigatorFontSize", 11) // actually we use a dynamic integer const here
// so we can have differing values on OS X linux & Windows
end get
Set
prefs.WeadInteger("NavigatorFontSize", value)
end get
Sorry, take that back, I use GraphicsMagick not ImageMagick. GM is an offshoot of IM but has some additional features. Look in the MBS Examples/GraphicsMagick/ folder for the GM Exif example project.