All Manuals > CAPI User Guide > 10 Defining Interface Classes

NextPrevUpTopContentsIndex

10.2 An example interface

Here is a simple example of interface definition done with define-interface :

(define-interface demo ()
  ()
  (:panes
   (page-up push-button 
            :text "Page Up")
   (page-down push-button
              :text "Page Down")
   (open-file push-button
              :text "Open File"))
  (:layouts
   (row-of-buttons row-layout
                   '(page-up page-down open-file)))
  (:default-initargs :title "Demo"))

An instance of this interface can be displayed as follows:

(make-instance 'demo) (display *)

At the moment the buttons do nothing, but they will eventually do the following:

Figure 10.1 A demonstration of a CAPI interface

Later on, we will specify callbacks for these buttons to provide this functionality.

The (:default-initargs :title "Demo") part at the end is necessary to give the interface a title. If no title is given, the default name is "Untitled CAPI Interface".

Note: the define-interface form could be generated by the Interface Builder tool in the LispWorks IDE. See the LispWorks IDE User Guide for details. As the interface becomes more complex, you will find it more convenient to edit the definition by hand.

10.2.1 How the example works


CAPI User Guide (Windows version) - 30 Aug 2011

NextPrevUpTopContentsIndex