XML
  Home arrow XML arrow Back to XUL: The Interface
Dev Articles Forums 
ADO.NET  
Apache  
ASP  
ASP.NET  
C#  
C++  
ColdFusion  
COM/COM+  
Delphi-Kylix  
Design Usability  
Development Cycles  
DHTML  
Embedded Tools  
Flash  
Graphic Design  
HTML  
IIS  
Interviews  
Java  
JavaScript  
MySQL  
Oracle  
Photoshop  
PHP  
Reviews  
Ruby-on-Rails  
SQL  
SQL Server  
Style Sheets  
VB.Net  
Visual Basic  
Web Authoring  
Web Services  
Web Standards  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
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

Back to XUL: The Interface
By: Dan Wellman
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 1
    2006-01-23

    Table of Contents:
  • Back to XUL: The Interface
  • Adding the sub-menu
  • Don't forget the toolbar
  • The main content window

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb 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


    Back to XUL: The Interface


    (Page 1 of 4 )

    This article, the second in a series about the XML variant called XUL, gets you started on creating the main interface for an application. Among other things, it covers sub-menus, toolbars, and the main content window.

    Okay, so you have Mozilla installed and a text editor is open and awaiting your input?  Great, let’s get started on the main interface file.

    <?xml version="1.0"?>

    It was XML that put the X into XUL, so the rules that apply to XML documents also apply to XUL documents.  The document must be well-formed and you need the XML declaration at the top of your file.

    The top level element of XUL is the window element, which serves as a container for all other elements.  This must have the XUL namespace as an attribute:

    <window
           id="xuledit"
           title=”XUL Edit Lite 1.0”
           height="600"
           width="800"
           xmlns="http://www.mozilla.org/keymaster/gatekeeper/
    there.is.only.xul”>

    As a point of interest, the keymaster and gatekeeper used in the namespace are references to the classic movie "Ghostbusters."  Anyway, the id attribute is optional; it is used for referencing and scripting.  Other attributes include the title attribute, the value of which is displayed in the title bar at the top of the window, and the width and height attributes.  The most common screen resolution in use today is 800 x 600, so I've set the height and width attributes to these numbers.  When running XUL applications within Mozilla, they won’t have a title bar of their own.

    In most Windows applications, the menu bar is right at the top of whichever application you are using.  We will follow this tradition, so your next element (or group of elements) will be a menu bar:

    <toolbox>
        <menubar id="mainmenu">
        <menu id="menuFile" label="&fileLabel;" accesskey="F">

    The menu is encapsulated within a toolbox element so that it can be expanded or collapsed using a grippy.  This is not strictly necessary but I like it, and we want our application to integrate smoothly with Mozilla, so using standard features like this helps retain consistency.

    As you can see, the label is an entity reference rather than the actual text that is being displayed.  This is partly because XUL experts insist that this is the proper way to do things and partly because it’s a good way of demonstrating how easy it is to provide alternative locale features, like supporting other languages.

    The accesskey attribute specifies the keyboard key that can be used as a shortcut in combination with the ALT key.  Again, this is universal in Windows applications.

    More XML Articles
    More By Dan Wellman


       · Hi everyone, this article sees the creation of the interface itself; a fully...
     

    XML ARTICLES

    - 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
    - Simple Web Syndication with RSS 2.0
    - Java UI Design with an IDE







    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 1 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek