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

static-layout-child-position Accessor Generic Function

Summary

Gets and sets the location of an object inside its parent static-layout.

Package

capi

Signature

static-layout-child-position self => x, y

setf (static-layout-child-position self) (values x y) => x, y

Arguments
self
A pinboard-object or a pane.
x, y
Non-negative integers.
Values
x, y
Non-negative integers.
Description

The accessor generic function static-layout-child-position returns as multiple values x, y the horizontal and vertical coordinates of self inside its parent static-layout.

There is also a setf expansion which sets the location of self in its parent.

Examples
(let* ((po (make-instance 'capi:item-pinboard-object 
                          :text "5x5" :x 5 :y 5
                          :graphics-args 
                          '(:background :red)))
       (pl (capi:contain 
            (make-instance 'capi:pinboard-layout 
                           :description (list po)
                           :visible-min-width 200
                           :visible-min-height 200))))
  (capi:execute-with-interface
   (capi:element-interface pl)
   #'(lambda (po)
       (dotimes (x 20)
         (mp:wait-processing-events 1)
         (let ((new-x (* (1+ x) 10))
               (new-y (* 5 (+ 2 x))))
           (setf (capi:item-text po)
                 (format nil "~ax~a" new-x new-y))
           (setf (capi:static-layout-child-position po)
                 (values new-x new-y)))))
   po))
See also

static-layout
static-layout-child-size


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