All Manuals > CAPI User Guide > 10 Defining Interface Classes > 10.2 An example interface

NextPrevUpTopContentsIndex

10.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:

  (:panes
   (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:

  (:layouts
   (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.


CAPI User Guide (Windows version) - 30 Aug 2011

NextPrevUpTopContentsIndex