Home arrow XML arrow Page 3 - Back to XUL: Introduction and Preparation

Back to XUL: Introduction and Preparation

XUL is an XML variant that can be used to create application user interfaces. It can also be used as an element in creating entire applications. This article, the first in a series, introduces you to the idea and helps you get your system ready to start creating.

Author Info:
By: Dan Wellman
Rating: 5 stars5 stars5 stars5 stars5 stars / 5
January 16, 2006
  1. · Back to XUL: Introduction and Preparation
  2. · Creating applications with XUL
  3. · Setting up your system for running XUL applications
  4. · More setup information

print this article

Back to XUL: Introduction and Preparation - Setting up your system for running XUL applications
(Page 3 of 4 )

As I mentioned above, there are two ways in which XUL applications can be run. One is within Mozilla, in the same way that a web page would be displayed in the main content window.  The second way allows standalone applications to be executed using the command line; the application will then appear in its own independent window, but as the splash-screen shows when you run it, it will still be powered by Mozilla. 

Neither option is any easier or harder to construct, as the code used within each is the same.  When creating programs designed to run within Mozilla, however, Mozilla itself kind of takes over as the main application and any keyboard shortcuts for menus in your application won’t work.  For example, if you create a File menu with the standard Alt + F keyboard shortcut, when you press Alt + F, Mozilla’s file menu will open instead of your own.  To avoid this and other subtle pitfalls, we will run the application within its own window.

This makes setting up your system for XUL a little more complicated because you have to add a system environment variable telling your computer what to do when XUL files are executed. Clearly, Mozilla needs to be installed on your system in order to follow this tutorial. I am using the latest version of the browser; at the time of writing that is version 1.7.12, on Windows XP Pro SP2.

Once installed, go to your Control Panel and open the System applet.  Once the System dialog box opens, select the Advanced tab and hit the Environment Variables button.  When the Environment Variables dialog box opens, find the Path variable and add the following line of code to the end of it:

;C:\Program Files\mozilla.org\Mozilla

Once this has been done (and your files have been registered of course), you can launch your application with the following command:

Mozilla –chrome chrome://nameofyourapp/content

You can create a XUL folder at this point on your C: drive to store the files that are going to be created in order to make the application work.  Now create an application folder within that called XULEditLite, and then in that folder create a locale, skin and content folder:


The content folder is going to be used to store the main XUL and script file(s).  The skin file is where button icons, other graphics, and style sheets separate from the main ones are kept.  The skins are segregated into their own directory to make it easier for people to add their own themes to your application.  Additionally, most developers now separate their applications in this way to provide a presentation layer separate from the main application layer, so that’s exactly what you should do too.  Finally, the locale folder is used to store DTDs that contain the labels and other text strings from the labels used in your application; within this folder, you should also create a folder called en-US.

blog comments powered by Disqus

- Open XML Finally Supported by MS Office
- XML Features Added to Two Systems
- Using Regions with XSL Formatting Objects
- Using XSL Formatting Objects
- More Schematron Features
- Schematron Patterns and Validation
- Using Schematron
- Datatypes and More in RELAX NG
- Providing Options in RELAX NG
- An Introduction to RELAX NG
- Path, Predicates, and XQuery
- Using Predicates with XQuery
- Navigating Input Documents Using Paths
- XML Basics
- Introduction to XPath

Watch our Tech Videos 
Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us 
Weekly Newsletter
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 

Developer Shed Affiliates


© 2003-2018 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials