XML
  Home arrow XML arrow Page 2 - Overlays in XUL
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

Overlays in XUL
By: Dan Wellman
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 1
    2006-05-15

    Table of Contents:
  • Overlays in XUL
  • Creating an overlay
  • Adjusting the overlay to your application
  • Creating a dynamic overlay

  • 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


    Overlays in XUL - Creating an overlay


    (Page 2 of 4 )

    Creating overlays is easy; you still need the XML declaration and the XUL namespace is added as an attribute of an <overlay> element instead of a <window> element.  Elements within the overlay file should have an ID attribute which is used to match the overlaid content with the main application.  Create a XUL file that contains the following code:

    <?xml version="1.0"?>
    <overlay xmlns="http://www.mozilla.org/keymaster/gatekeeper/
    there.is.only.xul">
    <menu id="overlaidMenu">
      <menupopup id="newPopup">
        <menuitem id="menuitem1" label="New item 1"/>
        <menuitem id="menuitem1" label="New item 2"/>
        <menuitem id="menuitem1" label="New item 3"/>
        <menuitem id="menuitem1" label="New item 4"/>
      </menupopup>
    </menu>
    </overlay>

    Now save this file into the content folder of your application with a filename of newmenuOverlay.xul.  Next, we need to import the overlay content into the main XUL file of the application; in this case, I am using the XUL editor created in previous articles as an example.  Near the top of the file, add the following processing instruction:

    <?xul-overlay
    href="chrome://interface/content/newmenuOverlay.xul"?>

    Finally, in the location that you would like the new menu to appear, add this code:

    <menu id="overlaidMenu" label="New Menu"/>

    As you can see, the ID of the element in both the overlay file itself, and the final line of code in the main application file are the same.  Notice also that the overlay file is understood and processed by Mozilla using a chrome URL, even though we haven’t registered the overlay with the chrome in the same way that we have had to register some of the other key elements of the application such as the DTD and skin files.  The chrome is intelligent enough to pick these up without special instructions.

    More XML Articles
    More By Dan Wellman


       · Hi,Overlays are an interesting and easy aspect of XUL to play around with, I...
     

    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 2 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek