Home arrow XML arrow Page 4 - Back to XUL: Completing the JavaScript Logic

Back to XUL: Completing the JavaScript Logic

The previous article saw us complete the File menu, making use of XPCOM to handle some of the more complex behaviors. This article will go on to discuss adding behavior to the two remaining menus, the Edit and Help menus.

Author Info:
By: Dan Wellman
Rating: 5 stars5 stars5 stars5 stars5 stars / 2
February 13, 2006
  1. · Back to XUL: Completing the JavaScript Logic
  2. · Defining a Function
  3. · The Help Menu
  4. · The About Window
  5. · Making the Toolbar Work
  6. · Finishing up the Functions

print this article

Back to XUL: Completing the JavaScript Logic - The About Window
(Page 4 of 6 )

The About window is even easier to code then the help system (and that was easy).  All you need to do is create a new XUL file, making use of the <dialog> element to contain the program information, then create a function in the JavaScript file that calls the openDialog() method.  The code for a very basic dialog window can be as follows:

<?xml version="1.0"?>

<dialog id="aboutDialog"
        title="About XUL Edit Lite"

    <description>XUL Edit Lite</description>
    <description>Version: 1.0</description>
    <description>Created by Dan Wellman</description>
    <description>December 2005</description>   



This is only very basic information and at this stage, without any CSS. It looks quite bad, but it should give you the general idea.  It can always be tidied up and made to look good when you get around to creating a skin for the application.  The JavaScript function is also very similar and should be added to the bottom of interface.js:

function lauchAbout() {



Finally, add the oncommand handler to the relevant menu item:

<menuitem id="menuAbout" label="&aboutLabel;" accesskey="A"
key="aboutKey" oncommand="lauchAbout()"/>

Once you’ve added the calls to these functions in the main XUL file, the menubar is complete; all of the elements should now have been wired up and working.  Before the application is finished however, we still need to add the code that will make the toolbar work.

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-2019 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials