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.
(setq button (make-instance 'push-button
:text "Hello"
:title "Press: "
:title-position :left
:callback 'hello))
(contain button :process nil)
(setf (titled-object-title button) "Press here: ")
As soon as the form is evaluated, the title of the pane you just created changes.
(setf (titled-object-title-font button)
(gp:merge-font-descriptions
(gp:make-font-description :size 42)
(gp:convert-to-font-description button
(titled-object-title-font button))))
Notice how the window automatically resizes in steps 2 and 3, to make allowance for the new size of the title.