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

NextPrevUpTopContentsIndex

20.3 Creating an interface layout

The default view in the Interface Builder is the layouts view, as shown in Displaying the layouts in the Interface Builder. You use this view to specify the entire GUI, with the exception of the menus. Click the Layouts tab to swap to this view from any other in the Interface Builder.

Figure 20.4 Displaying the layouts in the Interface Builder

The Interface Builder has three sections in the layouts view.

20.3.1 Interface box

The interface text box displays the name of the current interface; the interface that you are currently working on. Note that there may be several other interfaces loaded into the Interface Builder, but only one can be current.

To switch to another loaded interface, or to create a new interface, type the name of the interface into this area and press Return. You might find it useful to type just a few characters and then press Up or Down to invoke in-place completion. The interface you specify appears and its layouts are shown in the Interface Builder.

20.3.2 Graph area

This area displays, in graph form, the CAPI elements of the current interface.

By default, the graph is laid out from left to right. The main interface name is shown at the extreme left, and the layouts and elements defined for that interface are shown to the right. The hierarchy of the layouts (that is, which elements are contained in which layouts, and so on) is immediately apparent in the graph.

An item selected in the graph can be operated on by commands in the Object menu in the Interface Builder's menu bar. This menu contains the standard action commands described in Performing operations on selected objects, as well as a number of other commands described throughout this chapter.

To remove a layout or pane from your interface definition, select it in the graph area and choose Edit > Cut or press the toolbar button.

20.3.3 Button panels

At the bottom of the Interface Builder is a tab layouts, each tab of which contains a number of buttons. These tabs list the classes of CAPI elements that can be used in the design of your interface.

The precise list of items available depends on the package of the current interface. To change this package, choose Interface > Package... and specify a package name in the dialog that appears. You must specify a package which already exists in the Lisp image.

Note: The package of the current interface is not necessarily the same as the current package of the Interface Builder. Like all other tools, the Interface Builder has its own current package, which affects the display of symbol names throughout the tool; see Specifying a package for details. By contrast, the package of the current interface is the package in which the interface is actually defined. The window elements which are available for the current interface depend on the visibility of symbols in that package. By default, both the package of the current interface and the current package of the Interface Builder are set to CL-USER by default.

An element chosen from any of these areas can be operated on by commands in the Object menu. This menu contains the standard action commands described in Performing operations on selected objects.

20.3.4 Adding new elements to the layout

To add a new element to the layout, click the relevant button in any of the tabs in the button panel. The element is added as the child of the currently selected graph node. If nothing is currently selected, the element is added as the child of the last selected node.

Because construction of the interface layout is performed by selecting CAPI elements directly, you must be familiar with the way that these elements are used in the construction of an interface.

For instance, the first element to add to an interface is likely to be a CAPI layout element, such as an instance of the row-layout class or column-layout class. Not surprisingly, these types of element can be found in the Layouts tab of the button panel. Elements such as buttons or panes (or other layouts) are then added to this layout. In order to generate CAPI interfaces, it is important to understand that all window elements must be arranged inside a layout element in this way.

When you add an element to the design, two windows are updated:

When you add an item, an instance of that class is created. By default, the values of certain attributes are set so that the element can be displayed and the hierarchy layout updated in a sensible way. This typically means that name and title attributes are initialized with the name of the element that has been added, together with a numeric suffix. For instance, the first output pane that is added to an interface is called Output-Pane-1. You should normally change these attribute values to something more sensible, as well as set the values of other attributes. See Performing operations on objects for details about this.

For a practical introduction to the process of creating an interface using the Interface Builder, see Example: Using The Interface Builder.

20.3.5 Removing elements from a layout

To remove an element from a layout, select it in the graph area of the Layouts view and choose Edit > Cut or press the toolbar button.


LispWorks IDE User Guide (Windows version) - 13 Sep 2017

NextPrevUpTopContentsIndex