Diff for /books/www/chapters/ch02.html between versions 1.5 and 1.10

version 1.5, 2002/10/03 21:21:12 version 1.10, 2002/11/27 13:20:25
Line 53  examples are used throughout <A HREF="#7 Line 53  examples are used throughout <A HREF="#7
 <P><I>Example 2-2: <A NAME="77018"></A></I>  <P><I>Example 2-2: <A NAME="77018"></A></I>
 <I>The XUL namespace declaration</I>  <I>The XUL namespace declaration</I>
 <PRE> &lt;window  <PRE> &lt;window
   xmlns="<A HREF="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul</A>" /&gt;   xmlns="<A HREF="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul</A>"&gt;
    &lt;description&gt;Illustrating the XUL namespace&lt;/description&gt;     &lt;description&gt;Illustrating the XUL namespace&lt;/description&gt;
  &lt;/window&gt;</PRE>   &lt;/window&gt;</PRE>
   
Line 97  code viewer, described in <A HREF="appa. Line 97  code viewer, described in <A HREF="appa.
 <TT>&lt;window&gt;</TT> element. Using this  <!--INDEX window element, XUL:id attribute --> attribute is not necessary to run the windows system, but it is a good idea to give each window a unique identifier because it makes nodes easier to find from script (see the DOM method <TT>getElementByID</TT> in <A HREF="ch05.html#77037">Chapter 5</A> for information about how to get elements by identifier). This is how to set up an ID attribute:  <TT>&lt;window&gt;</TT> element. Using this  <!--INDEX window element, XUL:id attribute --> attribute is not necessary to run the windows system, but it is a good idea to give each window a unique identifier because it makes nodes easier to find from script (see the DOM method <TT>getElementByID</TT> in <A HREF="ch05.html#77037">Chapter 5</A> for information about how to get elements by identifier). This is how to set up an ID attribute:
 <PRE>&lt;window  <PRE>&lt;window
 xmlns:html="<A HREF="http://www.w3.org/1999/xhtml">http://www.w3.org/1999/xhtml</A>"  xmlns:html="<A HREF="http://www.w3.org/1999/xhtml">http://www.w3.org/1999/xhtml</A>"
xmlns="<A HREF="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul</A>"&gt;xmlns="<A HREF="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul</A>"
 id="xflyMain"&gt;</PRE>  id="xflyMain"&gt;</PRE>
 <P>Load event handlers such as <TT>onload</TT> and <TT>onunload</TT> are useful and  <!--INDEX load event handlers, window element, XUL --> necessary if you want to add behavior to a window, pass input to it, or manipulate its content depending on context:  <P>Load event handlers such as <TT>onload</TT> and <TT>onunload</TT> are useful and  <!--INDEX load event handlers, window element, XUL --> necessary if you want to add behavior to a window, pass input to it, or manipulate its content depending on context:
 <PRE>&lt;window  <PRE>&lt;window
Line 241  from the Mozilla navigator component--&g Line 241  from the Mozilla navigator component--&g
 <P>To access a script in XUL, use the <TT>script</TT> element  <!--INDEX XUL (XML-based User-interface Language):scripts, access;scripts:XUL, access --> and a URL value for its <TT>src</TT> attribute:  <P>To access a script in XUL, use the <TT>script</TT> element  <!--INDEX XUL (XML-based User-interface Language):scripts, access;scripts:XUL, access --> and a URL value for its <TT>src</TT> attribute:
 <PRE>&lt;script type="application/x-javascript"  <PRE>&lt;script type="application/x-javascript"
 src="chrome://xfly/content/xfly.js" /&gt;</PRE>  src="chrome://xfly/content/xfly.js" /&gt;</PRE>
<P>The <TT>dialogOverlay.js</TT> script imported into  <!--INDEX dialogOverlay.js script;scripts:dialogOverlay.js --> your XUL file in <A HREF="#77022">Example 2-4</A> provides access to the <TT>CenterWindoOnScreen( )</TT> function. This  <!--INDEX CenterWindowOnScreen( ) function, JavaScript;functions:JavaScript:CenterWindowOnScreen( );JavaScript:functions:CenterWindowOnScreen( ) --> function is made available to your XUL file with the line:<P>The <TT>dialogOverlay.js</TT> script imported into  <!--INDEX dialogOverlay.js script;scripts:dialogOverlay.js --> your XUL file in <A 
 HREF="#77022">Example 2-4</A> provides access to the <TT>CenterWindowOnScreen( )</TT> function. This  <!--INDEX CenterWindowOnScreen( ) function, JavaScript;functions:JavaScript:CenterWindowOnScreen( );JavaScript:functions:CenterWindowOnScreen( ) --> function is made available to your XUL file with the line:
 <PRE>&lt;script type="application/x-javascript"  <PRE>&lt;script type="application/x-javascript"
 src="chrome://global/content/dialogOverlay.js" /&gt;</PRE>  src="chrome://global/content/dialogOverlay.js" /&gt;</PRE>
 <P>All functions in <I>dialogOverlay.js</I> are imported into the scope of the XUL file and can be called directly, as <TT>CenterWindowOnScreen( )</TT> is in the <TT>onload</TT> event handler for the XUL window. Note that the functions contained in an imported JavaScript file are not broadcast in any particular way (though you can see them if you use the JavaScript Debugger). You may need to look around in the source code or see how other applications import files to find the functions you need, but the routines you want to use in your application code are probably already available in Mozilla.<A NAME="b260"></A><A HREF="#260">[*]</A>  <P>All functions in <I>dialogOverlay.js</I> are imported into the scope of the XUL file and can be called directly, as <TT>CenterWindowOnScreen( )</TT> is in the <TT>onload</TT> event handler for the XUL window. Note that the functions contained in an imported JavaScript file are not broadcast in any particular way (though you can see them if you use the JavaScript Debugger). You may need to look around in the source code or see how other applications import files to find the functions you need, but the routines you want to use in your application code are probably already available in Mozilla.<A NAME="b260"></A><A HREF="#260">[*]</A>
Line 331  data --> the XUL and XBL data, contained Line 332  data --> the XUL and XBL data, contained
          chrome:author="xfly.mozdev.org"           chrome:author="xfly.mozdev.org"
          chrome:name="xfly"&gt;           chrome:name="xfly"&gt;
    &lt;/RDF:Description&gt;     &lt;/RDF:Description&gt;
  >&lt;/RDF:RDF&gt;</PRE> &lt;/RDF:RDF&gt;</PRE>
   
 <P>In the content manifest in <A HREF="#77024">Example 2-5</A>, note the <TT>chrome:name</TT>, <TT>chrome:author</TT>, and the other metadata that the manifest provides to Mozilla. This information can be used by others to identify what your application is and who wrote it. For example, the name, author, and short description information for each browser theme you have installed is viewable by going to Preferences and selecting Appearance  &gt;  Themes.  <P>In the content manifest in <A HREF="#77024">Example 2-5</A>, note the <TT>chrome:name</TT>, <TT>chrome:author</TT>, and the other metadata that the manifest provides to Mozilla. This information can be used by others to identify what your application is and who wrote it. For example, the name, author, and short description information for each browser theme you have installed is viewable by going to Preferences and selecting Appearance  &gt;  Themes.
 <P>In <A HREF="#77026">Example 2-6</A>, which describes  <!--INDEX skins:xFly application;xFly:skins --> the skin for xFly only, note that new skin resources for the Classic theme are all that is supplied, as indicated in the <TT>RDF:Seq</TT>, which lists only <TT>classic</TT> as affected by this new package.  <P>In <A HREF="#77026">Example 2-6</A>, which describes  <!--INDEX skins:xFly application;xFly:skins --> the skin for xFly only, note that new skin resources for the Classic theme are all that is supplied, as indicated in the <TT>RDF:Seq</TT>, which lists only <TT>classic</TT> as affected by this new package.
Line 558  sometimes a matter of whom you know, and Line 559  sometimes a matter of whom you know, and
 determination, and patience.  determination, and patience.
 <HR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR>  <HR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR>
 <!-- ?php require(NOTES); ? -->  <!-- ?php require(NOTES); ? -->
<?php $post_to_list=NO; require(ANNOTATE); ?><?php $post_to_list=NO; $author='reviewers@mozdev.org'; $target_page='ch02'; require(NOTES); ?>
 </BODY>  </BODY>
 </HTML>  </HTML>

Removed from v.1.5  
changed lines
  Added in v.1.10


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>