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.
*
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.
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.
foreground
.Only those slots with the string "foreground" in their names are displayed.
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.
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.
(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