A single preference panel in a prefwindow
. A prefpane
is made up of two parts, the preferences descriptions, which specify the set of preferences that will be modified, and the user interface for adjusting those preferences. The former is specified using a preferences
element while the latter may be specified using other XUL elements.
Both may be specified directly as children of the prefpane
element, or the src
attribute may be used to put a pane in a separate file. In this latter case, the separate file should use an overlay
tag as its root tag since it will be loaded as an overlay to the main preferences window.
More information is available in the Preferences System article.
<prefpane id="paneGeneral" label="General" src="chrome://path/to/paneOverlay.xul"/>
or
<prefpane id="paneGeneral" label="General" onpaneload="onGeneralPaneLoad(event);"> <preferences> <preference id="pref_one" name="extensions.myextension.one" type="bool"/> ... more preferences ... </preferences> <checkbox label="Number one?" preference="pref_one"/> ... more UI elements ... </prefpane>
helpURI
onpaneload
load
event for a window.selected
true
for the currently selected prefpane
. To change the selected pane, use the prefwindow
's showPane
method.contentHeight
(readonly)loaded
preferenceElements
preferences
preference
elements in the pane.selected
true
if this element is selected, or false
if it is not. This property is read only. This property is available for menuitem
and menuseparator
elements in Firefox 3.DOMElement getPreferenceElement(in DOMElement startElement)
preferenceForElement( uielement )
preference
element to which a user interface element is attached.void userChangedValue(in DOMElement element);
onsynctopreference
handler for your listbox that returns the value to be written to the preference element, and then call the userChangedValue
function every time you edit the list in a way that should cause the preference's value to change.void writePreferences(in boolean flushToDisk);
paneload
onpaneload
attribute on the element.prefpane
sNote that when using multiple prefpane
s in the same prefwindow
, you must not put the <script>
elements above the prefpane
elements, but instead below them. Otherwise the dialog will show erratic behavior and not display correctly.
Place the <script>
tags as in the following example for preference dialogs to work correctly:
<prefwindow> <prefpane id="paneGeneral" label="General"> ... </prefpane> <prefpane id="paneSecurity" label="Security"> ... </prefpane> <script type="application/javascript" src="chrome://myext/content/script0.js"> <script type="application/javascript" src="chrome://myext/content/script1.js"> </prefwindow>
When opening a dialog with multiple panes you must include the toolbar
feature in the call to openDialog
, for example:
window.openDialog("chrome://example/content/prefwin.xul", "", "chrome,toolbar");
Preferences System documentation:
prefwindow
| prefpane
| preferences
| preference
| XUL attributes