3.2 GUI layout

As you have already seen above, in RapaGUI GUIs are defined entirely using the XML markup language. This allows you to quickly create GUI layouts by just composing a tree hierarchy made up of several windows, groups, and widgets. Here is an example of what an application tree could look like in an XML declaration:

 
<?xml version="1.0" encoding="iso-8859-1"?>
<application>
   <window title="Example GUI">
      <vgroup>
         <listview>
            <column/>
         </listview>
         <textentry/>
         <hgroup>
            <button id="add">Add</button>
            <button id="rem">Remove</button>
         </hgroup>
      </vgroup>
   </window>
</application>

And here is what this GUI looks like on Windows 7:

As you can see in the XML, no position coordinates or sizes are ever given. This is all calculated automatically by RapaGUI to ensure a clean appearance on all systems. Keep in mind that RapaGUI applications can run on a wide variety of systems: On Windows, GTK, macOS, and even on AmigaOS. By omitting hard-coded window and widget sizes and positions RapaGUI can automatically choose the best sizes and positions depending on the current screen and font size. Of course, you can also force RapaGUI to use hard-coded sizes by using the Area.Width and Area.Height attributes. To enforce a listview size of at least 600x400 device-independent pixels, you could just write:

 
<listview width="600" height="400">
   <column/>
</listview>

The only thing which you cannot modify is the widget position. Since the widget position highly depends on the current UI font size it really doesn't make sense to allow hard-coded widget positions in a cross-platform GUI toolkit because there will be massive differences between the different operating systems. Thus, RapaGUI doesn't allow you to hard-code widget positions.


Show TOC