Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


advertisement
 

XUL Defines New User Interface Options : Page 2

XUL is a new Netscape/Mozilla XML dialect that describes the elements of a traditional user interface. Faster and cleaner than HTML, it might just be the quickest way yet to code a UI.


advertisement
XUL is Critical in Mozilla
You'll need Mozilla to see the examples in this article, so download it if you don't already have it installed. You can install Mozilla multiple times in different directories, but be careful of upgrade issues. Read the release notes first.
Author's Note: Very important! If you have two installations (say an official 1.0 and an experimental 1.1), then, on Windows, running both at once doesn't work well. If you want to read some HTML and at the same time play with XUL, use IE to view the HTML and use Mozilla for development. You can do both with Mozilla, but if you have an obscure problem, debugging isn't as clean.
Figure 1: A blank document in Mozilla. Note that the URL is "about:blank", meaning there's no document loaded. Everything except the window frame and the title bar is generated by XUL.

Here's how to find some XUL. By default, when running Windows, Mozilla installs to the C:\Program Files\Mozilla directory. For the purposes of this article, I'll assume that that's where Mozilla's installed. However, if you upgraded from an earlier version of Mozilla, the upgrade process can put key files in C:\Windows\Application Data\Mozilla\.... If you have that directory, substitute it wherever you see C:\Program Files\Mozilla\... in the following discussion. In either case, when you start the browser, you see a normal HTML window. Type the URL about:blank into the address bar. That displays a blank page with no HTML in the window, as shown in Figure 1. Everything else visible in the screenshot, except for the Microsoft Windows blue title bar, is XUL, including the toolbars, background, menus—in short, everything visible except the window frame.

Figure 2: After removing Mozilla's access to the "chrome"<span class="pf"> </span>folder and thus the XUL files that define the browser's interface, launching the browser shows only the window frame and title bar, but no controls or content.
Here's a second (highly experimental) test. Shut down all instances of Mozilla, and temporarily rename the folder C:\Program Files\Mozilla\chrome to something else, such as chromeX. Then relaunch Mozilla. You'll see a tiny window as shown in Figure 2. By renaming the chrome folder, you removed Mozilla's access to all the default XUL files, and consequently, to Mozilla's entire user interface. Clearly XUL plays a critical role in the browser.

Don't forget to undo the renaming operation. If you browse the chrome directory, you'll see many, many .jar files. These are in ZIP format, so you can open them with WinZip or a similar tool. The .xul files inside those .jar files hold many examples of XUL.. The informed and the brave can hack these files. There are a large number of JavaScript files in there too. That's where the coding comes in. The XUL files define the interface elements, and the JavaScript files activate that interface.



Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date