Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Wiki Markup
{scrollbar}

h1. Example: Hello World in XUL

All XUL files have the .xul extension, but are otherwise written in XML-compliant markup language.
The DTD is pretty standard:

{code}
<?xml version="1.0"?>
{code}

And youcan must defineproivde a style sheet as well (this one is the default). This has no meaning in Pentaho XUL but makes previewing your XUL-file in Firefox much nicer:

{code}
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
{code}

Now you must declare a window, or whichdialog isas the root element of every XUL objectdocument. The id and title attributes are the only things you should change if you are using the reference rendering engine: window is often used as a placeholder in cases where we later pull a panel out to insert into a native UI (Spoon, RD).

{code}
<window id="hello_world" title="Hello World" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
{code}

A text box is the most basic XUL element. By default, the box will be horizontally oriented. Within the box you can put buttons, fields, and text. In this example, it's a simple box with one button:

{code}
<box>
<button id="Hello World!" label="Hello World!"/>
</box>
{code}

Then provide a closing tag for your window element:

{code}
</window>
{code}

Now type this into your favorite XML editor and try it out. Then check out the XUL reference to experiment with other elements
and
attributes: [http://developer.mozilla.org/en/docs/Category:XUL_Elements]

{scrollbar}