All Manuals > CAPI User Guide and Reference Manual > 21 CAPI Reference Entries

interface-display Generic Function

Summary

The function called to display an interface on screen.

Package

capi

Signature

interface-display interface

Arguments
interface
An instance of a subclass of interface.
Description

The generic function interface-display is called by display to display an interface on screen.

The primary method for interface actually does the work. You can add :before methods on your own interface classes for code that needs to be executed just before the interface appears, and :after methods for code that needs to be executed just after the interface appears.

interface-display is useful when you need to make changes to the interface which require it to be already be created. Font queries and loading images are typical cases.

Notes
  1. interface-display is called in the process of interface.
  2. interface-display is not called when interface is displayed as a dialog. Another way to run code before it appears on screen is to supply a create-callback for interface.
Examples

This example shows how interface-display can be used to set the initial selection in a choice whose items are computed at display-time:

(capi:define-interface my-tree ()
  ((favorite-color :initform :blue))
  (:panes
   (tree
    capi:tree-view
    :roots '(:red :blue :green)
    :print-function
    'string-capitalize))
  (:default-initargs 
   :width 200 
   :height 200))
 
(defmethod capi:interface-display :after 
  ((self my-tree))
  (with-slots (tree favorite-color) self
    (setf (capi:choice-selected-item tree)
          favorite-color)))
 
(capi:display (make-instance 'my-tree))
See also

display
interface
7 Programming with CAPI Windows
13 Drawing - Graphics Ports


CAPI User Guide and Reference Manual (Unix version) - 01 Dec 2021 19:32:42