3.3 Automatic layout engine

One of the most important and powerful features of MUI is its dynamic layout engine. As opposed to other available user interface tools, the programmer of a MUI application doesn't have to care about gadget sizes and positions. MUI handles all necessary calculations automatically, making every program completely screen, window size and font sensitive without the need for the slightest programmer interaction.

From a programmer's point of view, all you have to do is to define some rectangle areas that shall contain the objects you want to see in your window. Objects of group class are used for this purpose. These objects are not visible themselves, but instead tell their children whether they should appear horizontally or vertically.

For automatic and dynamic layout, it's important that every single object knows about its minimum and maximum dimensions. Before opening a window, MUI asks all its gadgets about these values and uses them to calculate the window's extreme sizes.

Once the window is opened, layout takes place. Starting with the current window size, the root object and all its children are placed depending on the type of their father's group and on some additional attributes. The algorithm ensures that objects will never become smaller as their minimum or larger as their maximum size.

The important thing with this mechanism is that object placement depends on window size. This allows very easy implementation of a sizing gadget: whenever the user resizes a window, MUI simply starts a new layout process and recalculates object positions and sizes automatically. No programmer interaction is needed.

As a consequence, you should never explicitly define fixed sizes for your windows and your windows' gadgets. Instead, MUI calculates these automatically depending on the current user preferences. Although it is possible to use fixed sizes for your window using Window.Width and Window.Height it is against MUI's philosophy to actually use these. Also, the gadget counterparts Area.FixWidth and Area.FixHeight should only be used if you have a very good reason for doing so. Normally, you should leave all layout calculation as well as gadget and window size determination to MUI's automatic layout engine which will make sure to give the user the ideal visual representation of your GUI layout.

Show TOC