Contents Up Previous Next

Programmatic versus interactive GUI building

Interactive tools for rapidly building GUIs are popular, and wxWindows has a simple screen painter and code generator called wxBuilder. wxBuilder can optionally generate wxWindows resource files (suffix .WXR) which helps to separate out detailed GUI specification from the code.

A different solution is taken by GWX which translates DevGuide files into wxWindows code, which has the advantages and disadvantages on relying on a third party GUI-building tool. It is also possible to translate some Windows .RC files into wxBuilder menus and dialog boxes, although the quality of the translation varies from good (with most menu bar definitions) to poor (for most dialogs).

It is not always possible to build GUI components interactively: the 'what you see is all you get' syndrome. When complex repositioning of items depending on window size is required, then GUI builders cannot be relied upon.

Using a toolkit with geometry management may be no panacea, either; for example, the Motif constraint algorithm is difficult to understand and much experimentation is necessary to make things work. The approach taken by wxWindows is in keeping with the main goal of simplicity: wxWindows has the ability to create panel items from left to right, top to bottom with appropriate horizontal and vertical spacing; or the programmer may position the panel items explicitly. The first method gives resolution and font independence, and is less fiddly, and the second method may be used for tidying up a display for a specific platform.

From wxWindows 1.62, there is a facility for simple constraint-based window layout, using the wxLayoutConstraints class. This can be a more powerful alternative to left-to-right panel item positioning, and is a good method for laying out subwindows without the need to right a complex OnSize member function.

Recent improvements to wxWindows opens the prospect of wxWindows-based 'visual' editing tools: panels and dialog boxes can be switched into user-interface edit mode, enabling panel items to be dragged and sized, and panel mouse clicks intercepted. Since this functionality is built in, it becomes relatively straightforward to construct dialog editors in any language linked to wxWindows.