All Manuals > LispWorks IDE User Guide > 2 A Short Tutorial

NextPrevUpTopContentsIndex

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 change the values of a slot programmatically.

  1. In the Listener, type * once again.
  2. 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.

  3. From the Listener, choose Values > Class .
  4. This creates a Class Browser, shown in Examining the class of an object using the Class Browser, which allows you to examine the class of the object contained in *.

    Figure 2.7 Examining the class of an object using the Class Browser

    Ensure that the Slots tab is selected, as in the illustration. In the Class: box, the name of the current Common Lisp class is printed. The list below the Filter box displays the slots available to the current class, and list labeled Description: displays the description of any selected slot. The filter works in the same way as the Inspector's filter. There is also a checkbox labeled Include Inherited Slots . Selecting this checkbox 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.

  5. Filter the display as you did for the Inspector; click in the Filter box, and this time type the word foreground.
  6. Only those slots with the string "foreground" in their names are displayed.

  7. Select the CAPI::FOREGROUND slot from the list. A description of the slot appears in the description area, including information such as the initargs, readers, and writers of the slot.
  8. Notice that the class text input pane has both a reader, capi:simple-pane-foreground, and a writer, (setf capi:simple-pane-foreground). We can use this information to programmatically change the text shown in the text input pane.

  9. Type this form into the Listener:
(setf (capi:simple-pane-foreground *) :red)

The text displayed in the text input pane is displayed in red 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.


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

NextPrevUpTopContentsIndex