4.2.2 Specifying titles directly

You can specify a title directly to all CAPI panes, using the :title keyword. This is much easier than using title-panes, since it does not necessitate using a layout to group two elements together.

Any class that is a subclass of titled-object supports the :title keyword. All of the standard CAPI panes inherit from this class. You can find out all the subclasses of titled-object by graphing them using the class browser.

The position of any title can be specified by using the :title-position keyword. Most panes default the title-position to :top , although some use :left .

You may specify the font used in the title via the keyword :title-font.

The title of a titled-object , and its font, may be changed interactively with the use of setf , if you wish.

  1. Create a push button by evaluating the code below:
  2. (setq button (make-instance 'push-button
                               :text "Hello"
                               :title "Press: "
                               :title-position :left
                               :callback 'hello))
    (contain button)
  3. Now evaluate the following:
  4. (apply-in-pane-process
     button #'(setf titled-object-title) "Press here: " button)

    As soon as the form is evaluated, the title of the pane you just created changes.

  5. Lastly evaluate the following:
 button #'(setf titled-object-title-font)
  (gp:make-font-description :size 42) 
   (titled-object-title-font button))) button)

Notice how the window automatically resizes in steps 2 and 3, to make allowance for the new size of the title.

LispWorks CAPI User Guide (Windows version) - 14 Jun 2006