XUL Tutorial - Single Document Version
223 pages
English

XUL Tutorial - Single Document Version

Le téléchargement nécessite un accès à la bibliothèque YouScribe
Tout savoir sur nos offres
223 pages
English
Le téléchargement nécessite un accès à la bibliothèque YouScribe
Tout savoir sur nos offres

Description

XUL Tu torial
1. Introduction
Introduction
This tutorial guides you to learning XU L (XML U ser-i nterface Language) which is a cross-
platform language for describing user interfaces of applications.
This tutorial will demonstrate creating a simple find file user interface, much like that provided by
the Ma cintosh's Sh erlock or the find file dialog in W indows. Note that only the user interface will
be created and some limited functionality. The actual finding of files will be not be implemented.
A blue line will appear to the left of a paragraph where the find file dialog is being modified. Yo u
can follow along at these sections.
What is X UL an d why w as i t created?
XU L (p ronounced zool and it rhymes with cool) was created to make development of the Mo zilla
browser easier and faster. It is an XML language so all features available to XML are also
available to XU L.
Mo st applications need to be developed using features of a specific platform making building
cross-p latform software time-co nsuming and costly. A number of cross-p latform solutions have
been developed in the past. Ja va, for example, has portability as a main selling point. XU L is
one such language designed specifically for building portable user interfaces. It takes a long
time to build an application even for only one platform. The time required to compile and debug
can be lengthy. W ith XU L, an interface can be implemented and modified quickly and easily.
XU L has all the ...

Sujets

Informations

Publié par
Nombre de lectures 88
Langue English
Poids de l'ouvrage 2 Mo

Exrait

XUL Tu torial 1. Introduction Introduction This tutorial guides you to learning XU L (XML U ser-i nterface Language) which is a cross- platform language for describing user interfaces of applications. This tutorial will demonstrate creating a simple find file user interface, much like that provided by the Ma cintosh's Sh erlock or the find file dialog in W indows. Note that only the user interface will be created and some limited functionality. The actual finding of files will be not be implemented. A blue line will appear to the left of a paragraph where the find file dialog is being modified. Yo u can follow along at these sections. What is X UL an d why w as i t created? XU L (p ronounced zool and it rhymes with cool) was created to make development of the Mo zilla browser easier and faster. It is an XML language so all features available to XML are also available to XU L. Mo st applications need to be developed using features of a specific platform making building cross-p latform software time-co nsuming and costly. A number of cross-p latform solutions have been developed in the past. Ja va, for example, has portability as a main selling point. XU L is one such language designed specifically for building portable user interfaces. It takes a long time to build an application even for only one platform. The time required to compile and debug can be lengthy. W ith XU L, an interface can be implemented and modified quickly and easily. XU L has all the advantages of other XML languages. For example XH TML or other XML languages such as Ma thML or SVG can be inserted within it. Al so, text displayed with XU L is easily localizable, which means that it can be translated into other languages with little effort. What kinds of user-interfaces can be made with XUL? XU L provides the ability to create most elements found in modern graphical interfaces. So me elements that can be created are: • Input controls such as textboxes and checkboxes • Toolbars with buttons or other content • Me nus on a menu bar or pop up menus • Tabbed dialogs • Trees for hierarchical or tabular information • Ke yboard shortcuts The displayed content can be created from the contents of a XU L file or with data from a datasource. In Mo zilla, such datasources include a user's mailbox, their bookmarks and search results. The contents of menus, trees and other elements can be populated with this data, or with your own data supplied in an RDF file. There are several ways that XU L applications are created: • Firefox extension - an extension adds functionality to the browser itself, often in the form of extra toolbars, context menus, or U I to customize the browser U I. This is done using a feature of XU L called an overlay, which allows the U I provided from one source, in this case, the Firefox browser, to be merged together with the U I from the extension. Ext ensions may also be applied to other Mo zilla based products such as Thunderbird. • Standalone XULRunner application - XU LRunner is a packaged version of the Mo zilla platform which allows you to create standalone XU L applications. A browser isn't required to run these applications, as they have their own executable file. • XUL package - in between the other two are applications which are created in the same way as an extension, but they act like a separate application in a separate window. This is used when you don't want to have the larger size of a complete XU LRunner application, but don't mind requiring a Mo zilla browser to be installed to be able to run the application. • Remote XUL application - you can also just place XU L code on a web server and open it in a browser, as you would any other web page. This method is limited however, as there will be security concerns that will limit the kinds of things you will be able to do, such as opening other windows. The first three types all require an installation to be performed on the user's machine. However, these types of applications do not have security restrictions placed on them, so they may access local files and read and write preferences, for example. For extensions, the XU L files and associated scripts and images used by an application would be packaged into a single file and downloaded and installed by the user. Mo zilla applications such as Firefox provide an extension manager which allows packages to be installed without having to write a lot of complex code. It is also possible to open XU L files directly from the file system or from a remote web site, however they will be restricted in the kinds of operations they can do, and some aspects of XU L will not work. However, if you do want to load XU L content from a remote site, the W eb server must be set up to send XU L files with the content type 'application/vnd.mozilla.xul+xml'. XU L is usually stored in files with a .xul extension. Yo u can open a XU L file with Mo zilla as you would any other file, using the O pen File command from the File menu or typing the U RL into the address bar. What do I n eed to k now to u se this tutorial? Yo u should have an understanding of HTML and at least a basic understanding of XML and CSS. Here are some guidelines to keep in mind: • XU L elements and attributes should all be entered in lowercase as XML is case-se nsitive (u nlike HTML ). • At tribute values in XU L must be placed inside quotes, even if they are numbers. • XU L files are usually split into four files, one each for the layout and elements, for style declarations, for entity declarations (u sed for localization) and for scripts. In addition, you may have extra files for images or for platform specific data. XU L is supported in Mo zilla and browsers that are also based upon on the G ecko engine, such as Netscape 6 or later and Mo zilla Firefox. Due to various changes in XU L syntax over time, you will want to get the latest version for the examples to work properly. Mo st examples should work in Mo zilla 1 .0 or later. XU L is fairly similar in
  • Accueil Accueil
  • Univers Univers
  • Ebooks Ebooks
  • Livres audio Livres audio
  • Presse Presse
  • BD BD
  • Documents Documents