Rich Internet for Everyone (RICHIE) Network: United XAML - XUL Alliance - XUL News - XUL Forum - The Richmond Post - RichCon 2005
The Richmond Post Logo
Chronicle of the Xul Revolution
« Swix Goes Live - Tiny Apache-Licensed XUL Motor for Swing Apps or Applets | Main | XUL News Wire Goes Live »
From The Trenches: Inside SharpDevelop: Project Lead of Open-Source .Nyet Dev Studio Uses XML for UIs
posted by Gerald Bauer on May 10, 2003

Christian Holm, Mike Kruger (SharpDevelop Project Lead) and Bernhard Spuida write in chapter 2 "Designing the Architecture" in the hot-off-the-press dev book titled "Dissecting A C# Application: Inside SharpDevelop":

Another important decision was to use XML for every data file, and to move as much data from the code to XML as possible. [...]

XML helps us in cleaning up code; often the code is bloated with information that could be easily stored in a separate file. In this code many properties are being set, and objects are created without doing anything with them. [...]

A good example is the GUI code where buttons, forms, group boxes, and other controls are defined. Each of these has properties assigned to it, information on where it is, which label it has, and other details. This code doesn't really add functionality to a program. It just defines the way something looks. XML is a good way to collect all this data in a file. So we began to use XML to reduce the actual code size.

[...] one of our next steps will be to design a better XML format for dialogs and panels. We plan to use a format that works with layout management. SharpDevelop should run under a wide range of operating systems with different languages.

This is especially important if we want to be able to switch the GUI API. History has shown us that GUI APIs come and go. If you know a bit about Java you may have noticed that Java AWT (the first version of a Java GUI framework) was replaced by Java Swing, and some time back IBM released SWT (the most recent Java GUI toolkit from IBM). This could easily happen with the .Net platform, too.

SharpDevelop XML UI Sampling. For a first impression check out the dialog below that displays the GPL license in a rich text box.

<System.Windows.Forms.Form>
   <Text       value = "${res:Dialog.ViewGPL.DialogName}"/>
   <ClientSize value = "{Width=724, Height=400}"/>
   <ShowInTaskbar   value = "False"/>
   <MaximizeBox     value = "False"/>
   <MinimizeBox     value = "False"/>
   <Icon            value = "Icons.16x16.CopyLeftIcon"/>
   <FormBorderStyle value = "FixedDialog"/>
   <StartPosition   value = "CenterScreen"/>
   <AcceptButton    value = "okButton"/>
	
   <Controls>
      <!-- The rich text box in which the GPL is shown -->
      <System.Windows.Forms.RichTextBox>
         <Name     value = "licenseRichTextBox"/>
	 <TabIndex value = "0"/>
	 <ReadOnly value = "True"/>
	 <Font     value = "Times New Roman, 12"/>
	 <Width    value = "724"/>
	 <Height   value = "371"/>
	 <BorderStyle value = "${BorderStyle}"/>
      </System.Windows.Forms.RichTextBox>
		
      <!-- OK Button -->
      <System.Windows.Forms.Button>
         <Name    value = "okButton"/>
	 <Width   value = "64"/>
	 <Height  value = "24"/>
 	 <Location value = "{X=330, Y=371}"/>
	 <TabIndex value = "1"/>
	 <Text     value = "${res:Global.OKButtonText}"/>
	 <DialogResult value = "OK"/>
	 <FlatStyle value = "${FlatStyle}"/>
      </System.Windows.Forms.Button>
   </Controls>
</System.Windows.Forms.Form>

Full story at http://www.icsharpcode.net/opensource/sd and http://sourceforge.net/projects/sharpdevelop and http://www.wrox.com/books/1861008171.htm.

SourceForge Logo Please send comments on our web pages to our public xul-talk mailinglist or to a member of our web team. Copyright © 2003, 2004, 2005 Open XUL Alliance