Recent Widgets


Register for DashboardWidgets

Recent Forums Posts

Partners


iCompositions

MacDesktops.net

RSS Showcase
RSS Comments
RSS Forums

This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies. Posted in: Widget Development

Setting initial preferences

Author Message
gesiwuj



Joined: 16 Mar 2008
Posts: 4

Posted: Tue Mar 18, 2008 - 1:01 pm    Post subject: Setting initial preferences Reply with quote

Hi, I have a widget with a GLARING bug that's technically easy to fix; but I'm unsure of the exact mechanics to do so.

In short, the widget and many of its functions rely on there being a value in one of my preferences. The widget works like a treat in Dashcode, because I have all the preferences with values in already (from days of testing) but as a package, it won't have these preferences.

Basically, I want one of my preference keys (it's basically the user's home city) to have a default value (say San Francisco) when the user loads the widget for the first time. Any simple way this can be achieved?

Thanks
View user's profile Send private message Send e-mail Widgets
Greenie



Joined: 08 Jun 2005
Posts: 81

Posted: Wed Mar 19, 2008 - 6:21 am    Post subject: Reply with quote

The most reliable way, imho, would be this:

1. Set all variables that can be read from preferences to an initial, valid value in your code.

2. When you read in the preferences from disc, replace the initial values with the ones read only if the preference-file has valid values for them.
View user's profile Send private message Send e-mail AIM Address ICQ NumberWidgets
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.

 
Powered by phpBB © 2001, 2002 phpBB Group