Next Prev Up Top Contents Index

element

Class
Summary

The class element is the superclass of all CAPI objects that appear in a window.

Superclasses

capi-object

Subclasses

simple-pane
menu

Slots

parent

The element containing this element.

interface

The interface containing this element.

 

Initargs

:visible-min-width


The minimum width of the element.

:visible-min-height


The minimum height of the element.

:visible-max-width


The maximum width of the element.

:visible-max-height


The maximum height of the element.

x

The x position for the element in a pinboard.

y

The y position for the element in a pinboard.

Accessors

element-parent

Readers

element-interface

Description

The class element contains the slots parent and interface which contain the element and the interface that the element is contained in respectively. The writer method element-parent can be used to re-parent an element into another parent (or to remove it from a container entirely by setting its parent to nil ). Note that an element should not be used more in more than one place at a time.

All elements accept hints as to the initial size and position of the element in question. By default elements have a minimum pixel size of one by one, and a maximum size of nil (meaning no maximum), but any of the following hints can be specified to change these values:

:x

The x position of the element.

:y

The y position of the element.

:visible-min-width


The width of the element.

:visible-min-height


The minimum height of the element.

:visible-max-width


The maximum width of the element.

:visible-max-height


The maximum height of the element.

:best-width

The initial width of the element.

:best-height

The initial height of the element.

The possible values for these hints are as follows:

integer

The size in pixels.

t

For :visible-max-width and :visible-max-height , means use the minimum.

:text-width

The width of any text in the element.

:screen-width

The width of the screen.

:screen-height

The height of the screen.

Also, hints can be a list starting with any of the following operators, followed by one or more hints.

max

The maximum size of the hints.

min

The minimum size of the hints.

+

The sum of the hints.

-

The subtraction of hints from the first.

*

The multiplication of the hints.

/

The division of hints from the first.

Finally, you can choose to apply or funcall an arbitrary function, by passing a list starting with funcall or apply , followed by the function and then the arguments.

Compatibility Note

The :min-width , :max-width , :min-height , and :max-height initargs are still accepted for compatibility with LispWorks 3.2, but their use is discouraged.

In LispWorks 4, :visible - min-width means the same as :min-width, but takes precedence if both are specified. The use of :min-width can lead to confusion because some CAPI classes have default values for :visible-min-width which will override :min-width . Similarly for : min-height , :max-width , and :max-height . Therefore, your code should use :visible-min-width and friends.

Examples
(capi:display (make-instance 'capi:interface
                              :title "Test"
                              :visible-min-width 300))
(capi:display (make-instance 'capi:interface
                              :title "Test"
                              :visible-min-width 300
                              :visible-max-height 200))

Here is a simple example that demonstrates the use of the element-parent accessor to place elements.

(setq pinboard (capi:contain
                (make-instance
                 'capi:pinboard-layout)
                :visible-min-width 300
                :visible-min-height 300
                :process nil))
(setq object (make-instance
              'capi:image-pinboard-object
              :x 10 :y 10
              :image "new-lispworks-logo"
              :parent pinboard))
(setf (capi:element-parent object) nil) (setf (capi:element-parent object) pinboard)
See also

set-hint-table


LispWorks CAPI Reference Manual - 14 Dec 2001

Next Prev Up Top Contents Index