All Manuals > LispWorks IDE User Guide > 20 The Interface Builder


20.2 Creating or loading interfaces

In the context of this chapter, an interface refers to any single window which is used in an application. Thus, an editor, an Open File dialog, or a confirmer containing an error message are all examples of interfaces. The GUI for a complete application is liable to comprise many interfaces. You can load as many different interfaces into the Interface Builder as you like, although you can only work on one interface at once. More formally, the class capi:interface is the superclass of all CAPI interface classes, which is the set of classes used to create elements for on-screen display. You can load any code which defines instances of this class and its subclasses into the Interface Builder.

Once you have invoked the Interface Builder, you can create new interfaces, or load any that have already been saved in a previous session. You must load or create at least one interface before you can proceed.

20.2.1 Creating a new interface

When you first start the Interface Builder, a new interface is created for you automatically. You can also choose File > New or click on to create a new interface. A blank window, known as the interface skeleton , appears on-screen, as shown in Skeleton window. The interface skeleton contains no layouts or panes, or menus.

Figure 20.2 Skeleton window

You can use File > New to create as many interfaces as you want; they are all displayed as soon as you create them. Since you can only work on one interface at a time, use the History > Items submenu or the and toolbar buttons to switch between different interfaces that are currently loaded in the Interface Builder.

As an alternative, type the name of an interface directly into the Interface text box and press Return to create a new interface, or to switch to an interface which is already loaded.

20.2.2 Loading existing interfaces

In the Interface Builder, choose File > Open... or click to load an existing interface. You can load any CAPI interface, whether it is one that you have designed using the Interface Builder, or one that has been hand-coded using the CAPI. You can load as many interfaces as you want, and then use the History > Items submenu to swap between the loaded interfaces when working on them.

To load one or more existing interfaces:

  1. Ensure the Interface Builder is the active window, and choose File > Open... .
  2. A file prompter dialog appears.

  3. Choose a file of Common Lisp source code.
  4. You should choose a file that contains the source code for at least one CAPI interface. If the file does not contain any such definitions, a dialog appears informing you of this.

    Once you have chosen a suitable file, for example the LispWorks library file examples/capi/buttons/buttons.lisp, a dialog appears listing all the interface definitions that have been found in the file, as shown in Choosing which interfaces to load into the Interface Builder. This lets you choose which interface definitions to load into the Interface Builder. By default, all the definitions are selected. You can select as many or as few of the listed interfaces as you like; the All or None buttons can help to speed your selection. Click Cancel to cancel loading the interfaces altogether.

    Figure 20.3 Choosing which interfaces to load into the Interface Builder

  5. Select just the Button-Test interface and click OK to load it into the Interface Builder.

Note: the File > Open... command in other tools does not display this dialog. To load an interface definition, ensure the Interface Builder window is active.

LispWorks IDE User Guide (Unix version) - 12 Feb 2015