At 10:42 AM 4/28/2004, you wrote:
I did try preferences, but I'm still a bit new to this and can't seem to get it to work right. Basically it crashes once I get it to compile. I really could use an example of one that was done properly, because Im a little lost here :(
//I tried to set the preference with this
PrefSetAppPreferences('mine', PrefDay, 0x01, dtStartDate.day, sizeof(dtStartDate.day), true);
Your fourth parameter should be "&dtStartDate.day" -- I'm surprised you aren't getting a compilation error.
//on program entry I tried to read the preference like this
if (PrefOpenPreferenceDB(false))
You never need to do this. PrefOpenPreferenceDB is a system-use only function.
//this causes a problem later on in the
program
{
day = 1;
// PrefGetAppPreferences('mine', PrefDay, day, sizeof(day),
true);
Again, here you need to pass the address of day, not day itself.
Have you actually looked at other code in Palm OS that uses preferences? All of the sample apps use them, and even the skeleton application generated by the CodeWarrior wizards has simple code to save and restore a pref.
-- Ben Combee, DTS technical lead, PalmSource, Inc. Read "Combee on Palm OS" at http://palmos.combee.net/
-- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/
