Difference between revisions of "How to do a Hello World application using XULRunner"
m (→Creating some XUL) |
|||
Line 1: | Line 1: | ||
'''Note: This page is still under construction''' | '''Note: This page is still under construction''' | ||
+ | |||
+ | == Introduction == | ||
== Setting up an application file structure == | == Setting up an application file structure == | ||
Line 92: | Line 94: | ||
Make sure your in the application level of the XULRunner application. | Make sure your in the application level of the XULRunner application. | ||
+ | |||
+ | == Conclusion == | ||
+ | |||
== References == | == References == |
Revision as of 14:58, 26 November 2006
Note: This page is still under construction
Contents
Introduction
Setting up an application file structure
First set up the application file structure to the following:
/applicationName /chrome /applicationName your app files chrome.manifest /defaults /preferences prefs.js application.ini
For more information about this section please visit the following link: File/Folder Structure
Setting up the application.ini file
The following is a sample application.ini file.
[App] Vendor=Mylau Name=Hello World Application Version=1.0 BuildID=20060101 Copyright=Copyright (c) 2006 ID=xulTestApp@mylau.org [Gecko] MinVersion=1.8 MaxVersion=1.8
To find more information about this file, click on the following link: application.ini File
Setting up the chrome.manifest file
For this example, the chrome.manifest file contains the following information:
content myapp file:content/
To find more information about this file, click on the following link: chrome.manifest File
Setting up the prefs.js file
The following was used for this simple application.
pref("toolkit.defaultChromeURI", "chrome://myapp/content/main.xul");
The pref function needs to be passed in two arguements. In this scenario, this document provided an explaination on what those two arguements are:
- toolkit.defaultChromeURI is a preferences which allows a simple XULRunner-based application to open a new window
- chrome://myapp/content/main.xul is the location of the main XUL file.
To find more information about this file, click on the following link: prefs.js File
Creating some XUL
For the simplicity of this application, we're going to create a simple XUL window that says hello world. First create a file called "main.xul". This file will be located in the following directory:
/myapp /content main.xul
This file will conatin the following code. This code will popup a XUL window with the words "hello word"
<?xml version="1.0"?> <?xml-stylesheet href="chrome://global/skin/" type="text/css"?> <window id="main" title="My App" width="300" height="300" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <caption label="Hello World"/> </window>
Running the application
To run the application, type the following:
If your on Windows:
xulrunner.exe application.ini
If your on Linux:
xulrunner application.ini
If your on Mac:
/Library/Frameworks/XUL.framework/xulrunner-bin application.ini
Make sure your in the application level of the XULRunner application.