It is possible to specify a title for a window, or part of a window. Several of the examples that you have already seen have used titles. There are two ways that you can create titles:
A title-pane is a blank pane into which text can be placed in order to form a title.
(setq title (make-instance 'title-pane
:visible-min-width 200
:text "Title"))
(contain title)
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 all the subclasses of titled-object by using the Class Browser tool in the LispWorks IDE.
Specify a title for a CAPI window by supplying the :title
initarg for the interface, and access it with interface-title
.
Further control over the title of your application windows can be achieved by using set-default-interface-prefix-suffix and/or specializing interface-extend-title as illustrated in Controlling the interface title.
You can call interface-display-title to get the string that is actually displayed (or would be displayed if the interface was displayed).
The position of any title can be specified by using the :title-position
keyword. Most panes default their
title-position
to :top
, although some use :left
.
You can place the title in a frame (like a groupbox) around its element by specifying :title-position :frame
.
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)
(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.
(apply-in-pane-process
button #'(setf titled-object-title-font)
(gp:merge-font-descriptions
(gp:make-font-description :size 42)
(gp:convert-to-font-description
button
(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.
CAPI User Guide and Reference Manual (Macintosh version) - 3 Aug 2017