6.3 Combining different layouts

You will not always want to arrange all your elements in a single row or column. You can include other layouts in the list of elements used in any layout, thus enabling you to specify precisely how panes in a window should be arranged.

For instance, suppose you want to arrange the elements in your window as shown in A sample layout. The two buttons are shown on the right, with the text input pane and a message on the left. Immediately below this is the editor pane.

Figure 6.3 A sample layout

The layout in A sample layout can be achieved by creating two row layouts: one containing the display pane and a button, and one containing the text input pane and the other button, and then creating a column layout which uses these two row layouts and the editor.

(setq row1 (make-instance 'row-layout
                  :description (list message button1)))
(setq row2 (make-instance 'row-layout
                  :description (list text button2)))
(contain (make-instance 'column-layout
                          (list row1 row2 editor)))

Figure 6.4 An instantiation of the sample layout

As you can see, creating a variety of different layouts is simple. This means that it is easy to experiment with different layouts, allowing you to concentrate on the interface design, rather than its code.

However, remember than each instance of a CAPI element must not be used in more than one place at the same time.

LispWorks CAPI User Guide (Windows version) - 14 Jun 2006