This article, the second in a series about the XML variant called XUL, gets you started on creating the main interface for an application. Among other things, it covers sub-menus, toolbars, and the main content window.
The editor element has more functionality than most of the rest of the application added together, yet it takes the least amount of code. Many XUL elements have a good deal of functionality built into them, which from a developerís point of view is excellent because it cuts down dramatically on the size of the application and the time it takes to program.
The editortype can be either HTML or text; for this project, this is of course set to text. The type is set to content-primary to make it the default window; this is needed for closing the current editor window easily (which is discussed later in this series, in article four). Before you can use the editor as an editor, a point to remember is that it must be made editable first.
For reference, the entire keyset at the top of the code should now appear thus:
The cut keyboard shortcut is declared using a non-letter reference, which is usually a VK_ prefix, followed by the full name of the key you want to use.
In all honesty, weíve taken some shortcuts here; most application developers would spend a lot more time in the planning phase. Those of you educated to degree level will probably have heard of JSP or Jackson Structured Programming (among other things). This is a method of programming whereby the logic of each of the many processes that occur within the application are mapped out visually using flow-chart style icons. Personally, I donít think that level of detail is required for such a small program written in such an intuitive language. At the very least however, Iím sure that in a production environment the functions would first be written in pseudo-code. I left this out also because this is a tutorial and Iím basically telling you what to do.
It has been fairly easy so far to create an attractive interface, not unlike creating a simple web page. The next article will go on to show you how to get the interface registered with chrome, how to create the descriptive RDF file and where to put the DTD to generate all of the display text.
DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.