XML
  Home arrow XML arrow Page 4 - An Introduction to XUL Part 1
Dev Shed Forums 
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Forums Sitemap 
IBM® developerWorks 
Sun Developer Network 
Dedicated Servers 
E-Commerce Hosting 
Linux Web Hosting 
Managed Hosting 
Small Business Hosting 
Actuate Whitepapers 
VeriSign Whitepapers 
VPS Hosting 
Weekly Newsletter

 
Developer Updates  
Free Website Content 
IBM developerWorks
 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

An Introduction to XUL Part 1
By: Dan Wellman
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 2 stars2 stars2 stars2 stars2 stars / 21
    2005-05-23

    Table of Contents:
  • An Introduction to XUL Part 1
  • Getting started
  • Follow the rules
  • Adding buttons

  • 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

    Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here

    An Introduction to XUL Part 1 - Adding buttons


    (Page 4 of 4 )

    So, moving back to your first XUL window, you might now want to add some buttons. Buttons are added using the button tag, and have quite a few attributes that you can use.  Modify the XUL file like this:

    <?xml version="1.0"?>
    <?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
    <window id="MySecondWindow" title="My First XUL Window with buttons!"   width="400" height="300" screenX="50" screenY="100"   xmlns="
    http://www.mozilla.org/keymaster/gatekeeper/
    there.is.only.xul
    ">
      <button label="I am a button!"/>
    </window>

    And save it as myFirstWindow2.xul, then use the command line to execute it. I’ve called the file myFirstWindow2 instead of mySecondWindow to make it easier for you to type on the command line. As long as you have stored the file in the same directory as the first, you can just press the up arrow on your keyboard to copy the command, and then modify myFirstWindow to myFirstWindow2. When you’re testing out these little files for any considerable time period, this will be a godsend, trust me! The first window file you saved can now be used as a basic template that you can open in Notepad when you design a new window, to save you having to type out the declaration and root element each time.

    You should now have a similar window with a big button on it.  To add an image to this button, you could use the following code:

    <button label="I am a button with an image on it!" image="xul.jpg"/>

    A similar button to the first one should appear when the file is executed, and the image it contains will be located to its default left placement.  The placement of the image can be adjusted so that the image appears to the right, above or below the text by using optional attributes:

    <button label="I am a button with an image on it!" image="xul.jpg" dir="rtl" />

    Would place the image to the right of the text;

    <button label="I am a button with an image on it!" image="xul.jpg" orient="vertical"/>

    Would place the image above the text, and;

    <button label="I am a button with an image on it!" image="xul.jpg" orient="vertical" dir="rtl"/>

    Would place it below the text. The next article will include information on some more of XUL's basic element tags.


    DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.

       · """I initially tried to do it using the command line method, which failed repeatedly...
       · Thanks for clearing that up for me, I was curious as to why the command line method...
       · Unfortunately, it would seem your advice is flawed. Windows is case-insensitive, so...
       · Hi,I use winxp pro, which does not appear to be case sensitive when adding the...
       · To set the path variable in the autoexec.bat file AND keep previous paths,...
     

       

    XML ARTICLES

    - 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...
    - SimpleXML
    - XForms Basics, Part 3
    - XForms Basics, Part 2
    - XForms Basics





    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway