Confirmed users
269
edits
(Adding accessibility markup improvement suggestions.) |
(→How to migrate a preference panel: Reacting dynamically to user input and preference changes) |
||
Line 19: | Line 19: | ||
====Tree items==== | ====Tree items==== | ||
Edit [http://mxr.mozilla.org/seamonkey/source/suite/common/pref/preferences.xul /suite/common/pref/preferences.xul] (or the respective overlay, if | Edit [http://mxr.mozilla.org/seamonkey/source/suite/common/pref/preferences.xul /suite/common/pref/preferences.xul] (or the respective overlay, if e.g. you're migrating a MailNews panel) and set the following attributes on the respective <treeitem>: | ||
<treeitem container="true" | <treeitem container="true" | ||
Line 111: | Line 111: | ||
These 'paneload' events are processed in the following order: | These 'paneload' events are processed in the following order: | ||
* SeaMonkey's derived <prefpane> 'paneload' handler is called, loading the scripts specified in the <prefpane>'s 'script' attribute. If defined, the <prefpane>'s Startup() function is called, so that <preference> elements can be created dynamically.<br><i style="color:red">Mind that UI elements tied to <preference>s are '''not''' yet initialized to their <preference> value here!</i> | * SeaMonkey's derived <prefpane> 'paneload' handler is called, loading the scripts specified in the <prefpane>'s 'script' attribute. If defined, the <prefpane>'s Startup() function is called, so that <preference> elements can be created dynamically.<br><i style="color:red">Mind that UI elements tied to <preference>s are '''not''' yet initialized to their <preference> value here!</i> Instead, simply read the value directly from the <preference> element. | ||
* Toolkit's <prefpane> 'paneload' handler is called and initializes the <preference> based UI elements. Any 'onsyncfrompreference' handlers attributes on such UI elements are evaluated. (See [https://bugzilla.mozilla.org/show_bug.cgi?id=308754 bug 308754] for problems with these handlers.) | * Toolkit's <prefpane> 'paneload' handler is called and initializes the <preference> based UI elements. Any 'onsyncfrompreference' handlers attributes on such UI elements are evaluated. (See [https://bugzilla.mozilla.org/show_bug.cgi?id=308754 bug 308754] for problems with these handlers.) | ||
* SeaMonkey's <prefwindow> 'paneload' handler is called, synchronizing <tree> and <prefpane>. | * SeaMonkey's <prefwindow> 'paneload' handler is called, synchronizing <tree> and <prefpane>. | ||
* Finally, any <prefpane> 'onpaneload' handler attribute is evaluated. | * Finally, any <prefpane> 'onpaneload' handler attribute is evaluated. | ||
====Reacting dynamically to user input and preference changes==== | |||
Under the v5 prefwindow it was very common for changes in one preference to affect the ability to use another preference. Since the preferences were a snapshot taken when the pane first loaded, the only synchronisation necessary was when the user interacted with the controlling preference. | |||
However unlike the v5 preferences, the v6 preferences support instant apply of preferences. This means that the preference elements need to keep themselves up-to-date with external preference changes so that the user can be sure they are seeing the current value of the preference. Synchronisation must therefore be done whenever the preference changes, whether or not this is due to a direct user interaction. | |||
Fortunately this is usually simply achieved by moving the oncommand or similar handler to an onchange handler on the <preference> element itself. | |||
== Accessibility markup enhancements == | == Accessibility markup enhancements == |