2 A Short Tutorial

2.6 Examining classes in the class browser

This section shows you how to use the class browser tool to examine information about the Common Lisp class of any given object. The examples given use the text input pane object that you created earlier, and show you how you can programmatically change the values of a slot.

1. In the listener, type* once again.

Notice that the* variable still contains the value of the text input pane object. This means that it is easy to perform several actions on that object. Notice further that the environment is aware that the object has been changed: the value returned by* reflects the change to the text slot that you made in the last section.

2. From the listener, choose Values > Class.

This creates a class browser, shown in Figure 2.6, which allows you to examine the class of the object contained in*.

Figure 2.6 Examining the class of an object using the class browser

The class browser contains more areas than the inspector. Below the menu bar, the name of the current Common Lisp class is printed. The list below the Filter area displays the slots available to the current class, and a Description area displays the description of any selected slot. The Filter area works in the same way as the inspector's Filter area. There is also a button labeled Include Inherited Slots. Clicking on this button lets you switch between displaying all the slots defined on the current class and all its superclasses, and only those slots defined directly on the current class. By default, slots defined on any superclasses (inherited slots) are shown in the main area.

3. Filter the display as you did for the inspector: move the focus to the Filter area, type the wordtext and then press Return.

Only those slots with the string "text" in their names are displayed. Notice that the list displayed here is different to the list that was displayed in the inspector, despite the fact that you are actually examining the same slots in each tool. This is because the inspector displays slot values as well as the slot names, and these values are included in any output displayed after using the filter.

4. Select theCAPI-INTERNALS:TEXT slot in the main area of the class browser. A description of the slot appears in the Description area, including information such as the initargs, readers, and writers of the slot.

Notice that the text input pane has both a reader,capi:text-input-pane-text, and a writer,(setf capi:text-input-pane-text). We can use this information to programmatically change the text shown in the text input pane.

5. Type this form into the listener:

(setf (capi:text-input-pane-text *) "Hello world!")

The text displayed in the text input pane is updated to reflect the new value you have specified. Notice how you were able to use the* variable to refer directly to the text input pane object itself.


Common LispWorks User Guide, Liquid Common Lisp Version 5.0 - 18 OCT 1996

Generated with Harlequin WebMaker