XUL Programmer's Reference Manual

<menulist>

Attributes Common Children
id <menupopup />
value  
crop  
disabled  
src  
oncommand  

The <menulist> element is XUL's own <select> element. It provides a general widget for selecting subelements from an option list. The children of the menulist (analogous to the nested <option> elements in HTML 4.0) are contained in a menupopup. The canonical example for using menulists is as follows:

<menubar>
  <menulist>
    <menupopup>
      <menuitem data="0" value="Do This"/>
     	<menuitem data="1" value="Do That" />
     	<menuitem data="2" value="Do Some Other Thing" />
    </menupopup>
  </menulist>
</menubar>

 
value
Description
value is an optional attribute that specifies the string that appears initially in the selection box.
Syntax
<menulist value="default string">
Example
<menulist value="select type of automobile">
Notes
When you do not specify a value for the menulist, then the first child of the menulist's popup will be displayed.


 

crop
Description
crop is an optional attribute for specifying which part of a menulist's text, if any, will be cropped if it is too large.
Syntax
<menulist crop="left| right | none" >
Example
<menubar>
  <menulist crop="right" value="Action" >
    <menupopup>
      <menuitem data="0" value="Do This"/>
     	<menuitem data="1" value="Do That" />
     	<menuitem data="2" 
   value="Do Some Other Thing That's Hard to Describe in a Single Line" />
    </menupopup>
  </menulist>
</menubar>
Notes
None.


 

disabled
Description
disabled is an optional attribute for disabling the <menulist> element.
Syntax
<menulist disabled=" true | false">
Example
<menulist value="Select an Action" disabled="true">
Notes
When a menulist is disabled, the default value (set with the value attribute) appears, but the pull-down cannot be activated, and the actual subelements are not available.


 

src
Description
src is an optional attribute for placing an image over the <menulist> element.
Syntax
<menulist src="pointer to graphic" >
Example
<menulist value="Cars" src="car1.gif" >
Notes
None.


 

Last updated: 3/27/00 Ian Oeschger