XUL:window
From MDC
« XUL Reference home [ Examples | Attributes | Properties | Methods | Related ]
Describes the structure of a top-level window. It is the root node of a XUL document. It is by default a horizontally oriented box. As it is a box, all box attributes can be used. By default, the window will have a platform-specific frame around it.
To set an icon for the window, create a platform-specific icon file <windowid>.ico and/or <windowid>.xpm and place or install these files into the <mozilla-directory>/chrome/icons/default/ directory. The <windowid> is the value of the id attribute on the window. This allows you to have a different icon for each window.
For properties and methods, see the XUL Window object.
More information is available in the XUL tutorial.
- Attributes
- height, hidechrome, id, screenX, screenY, sizemode, title, width, windowtype
[edit] Examples
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<window id="rootWnd" title="Register Online!"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<vbox>
<hbox>
<image src="application_form.png"/>
<description>Register Online!</description>
</hbox>
<groupbox align="start">
<caption label="Your Information"/>
<radiogroup>
<vbox>
<hbox>
<label control="your-fname" value="Enter first name:"/>
<textbox id="your-fname" value="Johan"/>
</hbox>
<hbox>
<label control="your-lname" value="Enter last name:"/>
<textbox id="your-lname" value="Hernandez"/>
</hbox>
<hbox>
<button oncommand="alert('save!')">
<description>Save</description>
</button>
</hbox>
</vbox>
</radiogroup>
</groupbox>
</vbox>
</window>
[edit] Attributes
|
Inherited from XUL element |
- height
- Type: string (representing an integer)
- The preferred height of the element in pixels. The actual displayed height may be different if the element or its contents have a minimum or maximum height. The CSS height property may also be used.
- hidechrome
- Type: boolean
- Set this attribute to
trueto have the chrome including the titlebar hidden.
- id
- Type: element id, must be unique in the window
- A unique identifier so that you can identify the element with. You can use this as a parameter to
getElementById()and other DOM functions and to reference the element in style sheets.
- screenX
- Type: integer
- The horizontal position at which the window appears on the screen.
- screenY
- Type: integer
- The vertical position at which the window appears on the screen.
- sizemode
- Type: one of the values below
- The state of the window. The following values may be used:
-
maximized: The window is maximized, and occupies the full size of the screen. -
minimized: The window is minimized, or hidden. -
normal: The window appears in a normal state at the desired size.
- title
- Type: string
- The text to appear in the title bar of the window.
- width
- Type: string (representing an integer)
- The preferred width of the element. The value should not include a unit as all values are in pixels. The actual displayed width may be different if the element or its contents have a minimum or maximum width, or the size is adjusted by the flexibility or alignment of its parent. The CSS width property may also be used.
- windowtype
- Type: string
- Set to a string which can be used to identify the type of window. This might be used, for example, to distinguish between a browser window and an editor window. Some of Mozilla's window handling functions use this attribute to group windows of the same type together.
[edit] Properties
|
Inherited from XUL element Inherited from DOM element |
[edit] Methods
|
Inherited from XUL element Inherited from DOM element |
[edit] Note
The error message "XML Parsing Error: undefined entity...<window" can be caused by a missing or unreachable DTD file referenced in the XUL file. A filename following the SYSTEM keyword in a DOCTYPE declaration may silently fail to load and the only error message will be an undefined entity error on the next XUL element.
[edit] Related
- Elements
- dialog, dialogheader
[edit] User Notes
To change the Icon to a window's title bar check this page on Window icons.
To add a favicon to the address bar and browser tab (ie dialog is not a popup) then use the following code snippet to use the html namespace and link.
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" xmlns:html="http://www.w3.org/1999/xhtml"> <!-- Icon from chrome --> <html:link rel="icon" href="chrome://myExtension/content/path/to/favicon.png"/> <!-- From a remote site --> <html:link rel="icon" href="http://www.mozilla.org/favicon.ico"/>