SeaMonkey:Toolkit Transition:PrefwindowPanes:HowTo: Difference between revisions

Line 53: Line 53:
* The ''label'' should have the same value as the the old <page>.''headertitle'' attribute. It will be shown above the panel.
* The ''label'' should have the same value as the the old <page>.''headertitle'' attribute. It will be shown above the panel.
* The ''script'' attribute contains a whitespace delimited list of chrome URIs of the script files to be loaded into the panel's(!) scope. This means that the contents of these scripts will be accessible as members of the <prefpane> object, eg. ''document.getElementById("navigator_pane").Startup()''.
* The ''script'' attribute contains a whitespace delimited list of chrome URIs of the script files to be loaded into the panel's(!) scope. This means that the contents of these scripts will be accessible as members of the <prefpane> object, eg. ''document.getElementById("navigator_pane").Startup()''.
* The ''onpaneload'' attribute can contain code which will be executed when the panel has finished loading. Eg. ''this.Startup()'' will work, but the special Startup() function will be called on panel load automatically anyway, if it exists.
* The ''onpaneload'' attribute can contain code which will be executed when the panel has finished loading, eg. ''this.Startup()''.
 
The old call to ''parent.initPanel'' is not needed anymore, panel initialization is done by the backend. If the panel's loaded scripts contain the special Startup() function, it will be called automatically on panel load.
 
==== 3. Preferences ====
Preferences handling required some complicated hack-arounds, this has changed.
 
Old:
<page>
  <script type="application/x-javascript">
  <![CDATA[
    var _elementIDs = ["startupPage", "newWinPage", "newTabPage",
                        "bookmarksButton", "goButton", "homeButton",
                        "printButton", "searchButton" ];
  ]]>
  </script>
...
  <checkbox id="homeButton"
            label="&homeButton.label;"
            accesskey="&homeButton.accesskey;"
            prefstring="browser.toolbars.showbutton.home"/>
 
New:
<overlay>
  <prefpane>
    <preferences id="navigator_preferences">
      <preference id="browser.toolbars.showbutton.home"
                  name="browser.toolbars.showbutton.home"
                  type="bool"/>
...
    </preferences>
...
    <checkbox id="homeButton"
              label="&homeButton.label;"
              accesskey="&homeButton.accesskey;"
              preference="browser.toolbars.showbutton.home"/>
235

edits