Lisp Knowledgebase

Title: Resizing CAPI interfaces and panes

ID: 16024


Product: All
Version: 4.2
OS: All

Description:
To change the height, width and coordinates of a CAPI top level interface use CAPI:SET-TOP-LEVEL-INTERFACE-GEOMETRY. Obtain the current geometry using CAPI:TOP-LEVEL-INTERFACE-GEOMETRY.

Example:

(defpackage "MY-PACKAGE" (:use "CAPI") (:add-use-defaults))

(in-package "MY-PACKAGE")

(defun move (interface x-shift y-shift)
 (multiple-value-bind (x y w h)
     (top-level-interface-geometry interface)
   (declare (ignore w h))
   (set-top-level-interface-geometry
    interface
    :x (if x-shift (+ x x-shift) x)
    :y (if y-shift (+ y y-shift) y))))




To change the constraints of a pane or layout use CAPI:SET-HINT-TABLE.

Example:


(defpackage "MY-PACKAGE" (:use "CAPI") (:add-use-defaults))

(in-package "MY-PACKAGE")

(define-interface my-interface ()
 ()
 (:panes
  (red
   output-pane
  :background :red)
  (green
   output-pane
  :background :green))
 (:layouts
  (ll
  row-layout '(red :divider green)))
 (:default-initargs
  :best-width 400
  :best-height 200))


;; Red and Green horizontally resizable arbitrarily via the divider
(display (setf rg (make-instance 'my-interface)) :process nil)

;; Red and Green now each constrained with a minimum width
(with-slots (red green) rg
 (set-hint-table red '(:visible-min-width 100))
 (set-hint-table green '(:visible-min-width 100)))

;; Red now forced to shrink to its minimum width
(with-slots (red) rg
 (set-hint-table red '(:visible-max-width t)))


See Also:
Workaround:
Patch:

Hardware:N/A
Summary:
Bug#:
Patch Enhancement#:
Reported:

Company     Contact     Privacy Policy     Terms of Use