All Manuals > CAPI User Guide and Reference Manual > 3 General Properties of CAPI Panes

3.3 Specifying titles

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:

3.3.1 Title panes

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)

A title pane

3.3.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 all the subclasses of titled-object by using the Class Browser tool in the LispWorks IDE. Window titles

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 11.5.2 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). Titles for elements

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.

  1. Create a push button by evaluating the code below:

    (setq button (make-instance 'push-button
                               :text "Hello"
                               :title "Press: "
                               :title-position :left
                               :callback 'hello))
    (contain button)
  2. Now evaluate the following:
     button #'(setf titled-object-title) "Press here: " button)

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

  3. 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.

CAPI User Guide and Reference Manual (Macintosh version) - 01 Dec 2021 19:31:17