XUL Programmer's Reference Manual
|
||||||||||||||||||||||||||||||||||
<box>
<titledbox>
The <box> widget provides a general purpose and flexible layout mechanism. Using boxes, you can specify the position and relationship of almost any combination of widgets in the UI. Many XUL widgets inherit from boxes, including: Boxes use flex to stretch their positions in a UI. Springs with flex push back against boxes, constraining them within the parent container. The following example shows a simple box and spring layout using all of box's basic attributes:
Titled BoxesThe titledbox is derived from the basic box, but supports a special child element for attaching a label-like title to the box container, as in the following example:
In all other respects, the <titledbox> element is the same as the box.
|
||||||||||||||||||||||||||||||||||
align | ||||||||||||||||||||||||||||||||||
Description
align is an optional attribute that specifies the alignment of the current element's children.Syntax <element align="left | right | center | vertical | horizontal">Example Notes The default value for align is left. In addition to the left, center, and right values, align also supports "horizontal" and "vertical", though these latter two are both deprecated. Remember that the attribute referes to the alignment of the children and not the parent element.
|
||||||||||||||||||||||||||||||||||
valign | ||||||||||||||||||||||||||||||||||
Description
valign is an optional attribute that specifies the vertical alignment of the current element's children.Syntax <element valign="top | middle | baseline | bottom ">Example Notes The default value for valign is middle. Remember that the attribute referes to the vertical alignment of the children and not the parent element.
|
||||||||||||||||||||||||||||||||||
flex | ||||||||||||||||||||||||||||||||||
Description
flex is used to position widgets and establish their flexibility relative to one another.
<element flex="integer">Examples Notes Flex is one of the principal ways to size and arrange widgets in the UI. Using boxes, springs, flex, and the functional XUL widgets you need, you can layout the interface in any way you choose.
|
||||||||||||||||||||||||||||||||||
width | ||||||||||||||||||||||||||||||||||
Description
width is an optional attribute that specifies the width of the box in pixels or percentage of available space.Syntax <element width="width in pixels">Example Notes<menubar width="100px" style="background-color:lightblue;"> When you do not specify a width or height, boxes and other elements will rely upon flex to figure out how much space to occupy. With no flex and no size attributes, a box will take only as much space as is needed to display whatever value or name attributes that have been specified.
|
||||||||||||||||||||||||||||||||||
height | ||||||||||||||||||||||||||||||||||
Description
height is an optional attribute that specifies the width of the box in pixels or percentage of available space.Syntax <element height="height in pixels">Example Notes<menubar height="100" style="background-color:lightblue;"> When you do not specify a width of height, boxes and other elements will rely upon flex to figure out how much space to occupy. With no flex and no size attributes, a box will take only as much space as is needed to display whatever value or name attributes that have been specified.
|
||||||||||||||||||||||||||||||||||
autostretch | ||||||||||||||||||||||||||||||||||
Description
autostretch is an optional attribute that turns a box's autostrething on and off.Syntax <element autostretch="never | always">Example Notes<box autostretch="never" style="background-color:lightblue;"> The autostretch attribute gives you control over a box's tendency to stretch its child elements to fit in the opposite direction of the box. When a box is aligned vertically, for example, it will stretch its children out horizontally automatically unless you specify otherwise. The figure below demonstrates how autostretch prevents the stretching of the box's button children.
|
||||||||||||||||||||||||||||||||||
orient | ||||||||||||||||||||||||||||||||||
Description
orient is an optional attribute that specifies the alignment of the children of the current element.Syntax <element orient="vertical | horizontal">Example Notes The orient attribute takes the place of align as the way to orient an element's child elements either end-to-end or top-to-bottom. Though align still accepts "vertical" and "horizontal" as values, these are now deprecated.
|
||||||||||||||||||||||||||||||||||
oncommand | ||||||||||||||||||||||||||||||||||
Description
oncommand is a generalized event listener attribute that's called when the user takes some action on the element.Syntax <element oncommand="javascript event handler code">Example Notes<box oncommand="alert('Parent box got the event')"> <menulist ... ... </box> The oncommand attribute is available to all elements that inherit from box, which is just about everyrthing in the toolkit. Use oncommand whenever you want to write an event handler for an element that doesn't have some more specific event listener attributes.
|
||||||||||||||||||||||||||||||||||