LispWorks CAPI User Guide > 9 Defining Interface Classes > 9.2 An example interface


9.2.1 How the example works

Examine the define-interface call to see how this interface was built. The first part of the call to define interface is shown below:

(define-interface demo ()

This part of the macro is identical to defclass -- you provide:

The interesting part of the define-interface call occurs after these defclass -like preliminaries. The remainder of a define-interface call lists all elements that define the interface's appearance. Here is the :panes part of the definition:

   (page-up push-button 
            :text "Page Up")
   (page-down push-button
              :text "Page Down")
   (open-file push-button
              :text "Open File"))

Two arguments -- the name and the class -- are required to produce a pane. You can supply slot values as you would for any pane.

Here is the :layouts part of the definition:

   (row-of-buttons row-layout
                   '(page-up page-down open-file)))

Three arguments -- the name, the class, and any child layouts -- are required to produce a layout. Notice how the children of the layout are specified by using their component names.

The interface information given so far is a series of specifications for panes and layouts. It could also specify menus and a menu bar. In this case, three buttons are defined. The layout chosen is a row layout, which displays the three buttons side by side at the top of the pane.

LispWorks CAPI User Guide (Unix version) - 22 Dec 2009