XML
  Home arrow XML arrow Page 4 - An Introduction to XUL Part 5
Dev Shed Forums  
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Smartphone Development  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Mobile Linux  
App Generation ROI  
IBM® developerWorks  
Forums Sitemap  
E-Commerce Hosting  
Linux Web Hosting  
Managed Hosting  
Small Business Hosting  
VPS Hosting  
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? 
Google.com  
XML

An Introduction to XUL Part 5
By: Dan Wellman
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: starstarstarstarstar / 9
    2005-06-20


    Table of Contents:
  • An Introduction to XUL Part 5
  • Buttons, JavaScript, and XPCOM
  • The nsIFilePicker interface
  • The keyset element

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


    An Introduction to XUL Part 5 - The keyset element
    ( Page 4 of 4 )

    One final thing you can use in the example is the keyset element. The keyset element is used to specify a key combination that someone using the application can press to select menuitems without having to navigate the menus. The keyset element contains its children, individual key elements that define the keyboard shortcuts. The key elements need an id attribute which ties in with an attribute used on the menuitem they are a shortcut for, a modifiers attribute which specifies which special key should be pressed, a key attribute which specifies the keyboard key used in conjunction with the special key, and an event that calls whichever function they should be associated with. For this example, you can use the following keyset:

    <keyset>
      <key id="openKey" modifiers="control" key="O"
        oncommand="openDialog();"/>
      <key id="saveKey" modifiers="control" key="S"
        oncommand="saveDialog();"/>
      <key id="exitKey" modifiers="control" key="E"
        oncommand="window,close();"/>
    </keyset>

    You’ll need to associate each of the keys to their respective menuitems, so add a key="openKey" attribute to the open menuitem, a key="saveKey" attribute to the save menuitem and a key="exitKey" attribute to the exit menuitem. Now save the file and access it again via Mozilla, and press Ctrl + o to bring up the open dialog. If you expand the menu yourself, you’ll see that Mozilla has added explanatory text to the relevant menuitems to advise of the keyboard shortcuts that can be used.

    This article has given an introduction to the object model used by XUL and has provided a basic example of the combination of Mozilla components and interfaces that make up the abstraction layer.  There is far, far more you can do using a combination of JavaScript and the XPCOM elements, anything in fact that any full-fledged application programming language can achieve.



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

       

    XML ARTICLES

    - 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...
    - Practical XML Data Design and Manipulation f...





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