XML
  Home arrow XML arrow Page 2 - An Introduction to XUL Part 3
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 3
By: Dan Wellman
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: starstarstarstarstar / 7
    2005-06-06


    Table of Contents:
  • An Introduction to XUL Part 3
  • Flex and Grids
  • Groupbox, Stack and Deck
  • Content Elements

  • 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 3 - Flex and Grids
    ( Page 2 of 4 )

    Flex

    A common attribute of elements placed in boxes is Flex, which makes the room the element uses an attribute of flexible.  In the example above, all of the buttons are the same size and there is a lot of left over space to the side of them.  Try adding a flex="1" attribute to the second opening vbox element.  Now the second set of buttons will take up all of the remaining available space in the window.  This is commonly used with spacers to make other elements appear in appropriate places within windows.  You may at this point be thinking that the value of flex is of a Boolean type, with 1 for true and 0 for false.  This is not the case; the flex attribute is of the integer type.  If you have multiple elements with the flex attribute, the attribute with the highest flex value will take up the most space.

    Grids

    Another positional element is the grid element, which allows you to specify both vertical and horizontal positions of elements.  The grid is commonly used with elements and their corresponding labels to ensure that everything lines up correctly within your interface.  The grid syntax is very easy to master; everything in the grid should be contained within an opening and closing grid element set, individual rows are defined within a rows opening and closing element set and individual columns are defined within a columns opening and closing element set.  Care should be taken when designing grids as it is easy to misplace elements.  Add the following code to a new XUL file and execute it in the normal way:

    <grid>
      <rows>
        <row>
          <button label="button1"/>
          <button label="button2"/>
          <button label="button3"/>
        </row>
      </rows>
         <columns>
              <column>
                <button label="button4"/>
                <button label="button5"/>
                <button label="button6"/>
              </column>
            </columns>
    </grid> 

    Now, the dilemma that you face here is that button 4 has overlaid and obscured button 1.  Generally, you would only add content to rows or columns rather than both to avoid this kind of conflict.  Try changing it to this to get the desired (in this example) effect:

    <grid>
      <rows>
        <row>
          <button label="button1"/>
          <button label="button2"/>
          <button label="button3"/>
        </row>
        <row>
         <button label="button4"/>
        </row>
        <row>
          <button label="button5"/>
        </row>
        <row>
          <button label="button6"/>
        </row>    
      </rows>
    </grid> 

    Much better!  Again, the flex attribute is more than welcome if you need to make elements stretch to fit the available space within the window.  In the example above however, the flex attribute may have unexpected results without the addition of columns.  Try adding the flex attribute to the first and last opening row elements to see how the buttons are affected.



     
     
    >>> 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