Home arrow XML arrow Page 4 - An Introduction to XUL Part 4

Adding to the installed-chrome.txt file - XML

Learn about XUL, a subset of XML used to describe user interfaces, that helps you to make rich user interfaces with nothing more complicated than a text editor. In the fourth part of this series you will learn about dialog boxes and wizards.

TABLE OF CONTENTS:
  1. An Introduction to XUL Part 4
  2. Using the RDF/XML Syntax
  3. Creating the Wizard
  4. Adding to the installed-chrome.txt file
By: Dan Wellman
Rating: starstarstarstarstar / 7
June 13, 2005

print this article
SEARCH DEV SHED

TOOLS YOU CAN USE

advertisement

So thatís the RDF file, and the wizard file is in place, but before the wizard can be accessed via chrome, you still need to add some code to another file -- the installed-chrome.txt file. This file lives in the default install directory of Mozilla. Open it up and add the location of your XUL file to the bottom (for clarity, the path to mine is C:/XUL/Chrome/mywizard.xul)

content,install,url,file:///C|/XUL/chrome/

You must add a hard return after this.  Now save the installed-chrome file, and from the same folder (the Mozilla chrome folder), delete the file called contents.rdf. Open Mozilla, and this file will be regenerated.  Open this file in a text editor, and you should be able to find the name of XUL wizard you have just created in there. To access your wizard, in the Mozilla address bar, type the following URL:

chrome://yourfilenamehere/content/

When the cancel or finish buttons are clicked Mozilla will close; this isnít because youíre doing something wrong, but because the wizard is not being opened from another XUL window. Also, there is no functionality behind this example wizard that would pass any values back to a calling window. 

Looking at the wizard through Mozilla, you might also agree that the example code in the wizard is a little difficult to distinguish from the narrative text of the wizard.  I mentioned in the first article that XUL is compatible with CSS, so what you might want to do is create the following CSS file:

.codetext {

  font-weight:bold;
  font-size:12pt;
  text-indent:20pt;
  background-color:#5B7693;
  padding:10pt;

}

I have called mine dansStyle.css but feel free to call it whatever you like. Save it in the same directory as your XUL and RDF files and add a stylesheet reference to the top of the wizard file:

<?xml-stylesheet href="dansStyle.css" type="text/css"?>

This needs to appear directly after the XML declaration.  Once that is in place, simply add a class="codetext" attribute to each of the opening description tags that enclose a CDATA element. Run the wizard once more and see your code highlighted, emboldened and indented to facilitate easy distinguishing of the example code.  

Wizards are often used to capture more complex input from a user than a simple yes or no (when a dialog window would be more appropriate).  Form controls can be placed inside wizards so that if, for example, a menu item was selected, the user could be guided through a series of questions or options. Once these questions had been answered, or the options selected, the results would be passed back to the window that the menu item that originally prompted the wizard resides in. In these cases, Mozilla would remain open. 

The next article will look at the creation of dialog boxes and discuss some of the more complex issues of these types of windows, such as opening or saving dialog boxes.



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

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort
   

XML ARTICLES

- Google Docs and Xpath Data Functions
- 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...

Developer Shed Affiliates

 


Dev Shed Tutorial Topics: