XML
  Home arrow XML arrow Page 3 - An Introduction to XUL Part 1
Dev Shed Forums  
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Smartphone Development  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Mobile Linux  
App Generation ROI  
IBM® developerWorks  
Forums Sitemap  
E-Commerce Hosting  
Linux Web Hosting  
Managed Hosting  
Small Business Hosting  
VPS Hosting  
Weekly Newsletter

 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid  
Request Media Kit
Contact Us  
Site Map  
Privacy Policy  
Support  
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
XML

An Introduction to XUL Part 1
By: Dan Wellman
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: starstarstarstarstar / 22
    2005-05-23


    Table of Contents:
  • An Introduction to XUL Part 1
  • Getting started
  • Follow the rules
  • Adding buttons

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      error-file:tidyout.log Del.ici.ous error-file:tidyout.log Digg
      error-file:tidyout.log Blink error-file:tidyout.log Simpy
      error-file:tidyout.log Google error-file:tidyout.log Spurl
      error-file:tidyout.log Y! MyWeb error-file:tidyout.log Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article

     
     
    ADVERTISEMENT


    An Introduction to XUL Part 1 - Follow the rules
    ( Page 3 of 4 )

    As XUL is an XML technology, the usual XML syntax rules apply; documents must begin with the XML declaration, all elements should be closed correctly, nested correctly, and so forth. All code, with the exception of string values, should be in lowercase, and the XUL namespace must be declared in the root element. Those used to XML will find the syntax of XUL very easy to get the hang of; in fact, it will sometimes seem intuitive.

    As stated above, you can create a XUL window using just a Notepad style application, so in Notepad, or the text editor of your choice, create your first XUL interface window by typing the following code:

    <?xml version="1.0"?>
    <window
      id="MyFirstWindow" title="My First XUL Window!" width="500"   height="300" screenX="50" screenY="100"   xmlns="
    http://www.mozilla.org/keymaster/gatekeeper/
    there.is.only.xul
    ">
    </window>

    All XUL documents should begin with the XML declaration, and all XUL elements will need to be contained within the window element, which must include the XUL namespace attribute shown above. As with any XML element, there are certain attributes that you can make use of to modify the appearance of the element in question. Here, the code specifies the id (for scripting purposes), the text that appears on the title bar, the dimensions, and where it should appear on screen.

    Now save the file as myFirstWindow.xul, and remember to change the "save as" drop-down to all applications or you’ll just end up with a file called myFirstWindow.xul.txt which won’t do anything interesting at all, even if opened from within Mozilla. Issue the execution command on the command line (Mozilla –chrome file://C:/XULApps/myFirstWindow.xul), and a very plain window should appear. You can make this look a little bit like Mozilla by including the stylesheet reference as follows above the opening window tag:

    <?xml-stylesheet href="chrome://global/skin/" type="text/css"?>

    Which at this early stage just gives you a kind of grayish background.
    The ref to the CSS file above contains the chrome directory, which forms part of the chrome architecture. The chrome architecture refers to the elements of Mozilla that make up how the interface looks.  Other applications that make use of XUL will also make use of a chrome directory for storing XUL, CSS and RDF files, and when making larger XUL applications, a directory structure that includes a chrome folder is something that you will need to make use of as well. RDF, by the way, stands for Resource Description Framework, and is another W3C recommended XML technology used to describe metadata (information about information).



     
     
    >>> More XML Articles          >>> More By Dan Wellman
     

       

    XML ARTICLES

    - Flex Array Collection Sort and Filtering
    - The Flex Tree Control
    - Flex List Controls
    - Working with Flex and Datagrids
    - How to Set Up Podcasting and Vodcasting
    - Creating an RSS Reader Application
    - Building an RSS File
    - An Introduction to XUL Part 6
    - An Introduction to XUL Part 5
    - An Introduction to XUL Part 4
    - An Introduction to XUL Part 3
    - An Introduction to XUL Part 2
    - An Introduction to XUL Part 1
    - XML Matters: Practical XML Data Design and M...
    - Practical XML Data Design and Manipulation f...





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 4 Hosted by Hostway
    Stay green...Green IT