Setting Widget Attributes
The Widget Attributes screen (see Figure 3) defines a number of important details about your widget.
Figure 3 Setting widget attributes
First and foremost is the Widget Identifier. This string is used by Mac OS X and Dashboard to uniquely identify your widget from all the other widgets out there. It also defines and how and where to store data about the state of your widget (position on screen, active/inactive, and so on), any user settings that your widget supports, and the version number of your widget.
The default string will be com.name.widget.Untitled (where name is the short name of your Mac OS X user account). You should change the name portion to reflect your personal website or business and the Untitled portion to reflect the name of your widget.
The Network/Disk Access and Extensions sections define how your widget interacts with a computer’s network connection and other files and applications.
Since Dashboard is based on webkit, which powers Safari, you can use the Extensions options to allow interaction with web browser plug-ins and Java applications. If you’re new to writing widgets and working from a template, you can leave them at their defaults.
The Widget plug-in allows you to extend the capabilities of a widget beyond what Javascript, CSS, and XHTML would ordinarily allow. Experienced Mac OS X developers can create plug-ins using Xcode that allow widgets to access various Cocoa programming libraries.
Using plug-ins, however, is discouraged for widgets in Leopard because plug-ins will typically require the widget to run a separate process from other widgets. This represents a change in Dashboard in Leopard, where most active widgets will be grouped under one or two parent processes to improve Dashboard performance.
The Properties section will vary depending on the type of widget you’re creating. In our Daily Feed example, the available properties include the Feed URL and the Feed Type (HTML or image content). You can often specify Properties here or directly in the widget when working in the Canvas (in this case by dragging and dropping a feed URL from Safari onto the widget). Both are valid ways to work in Dashcode, though not all properties can be defined from the Canvas.
In the Localization section, you can create localized versions of your widget for use in other languages. To add a language, select it from the plus-sign menu below the localization listbox. Then select it in the listbox and edit the appropriate values for each key (which corresponds to an interface element) and the widget name to match the language.