Lisp HUG Maillist Archive

CAPI: Restoring divider position III

Hi All,

 

my final contribution to my subject:

 

The most sensible approach to save and restore a divider position seems to be using layout-ratios.

 

(defvar *initial-width* 100)

 

(define-interface test ()

  ()

  (:panes

   (t1 text-input-pane)

   (t2 text-input-pane))

  (:layouts

   (l1 row-layout '(t1 :divider t2)))

  (:default-initargs

   :destroy-callback (lambda (self)

                       (with-geometry (slot-value self 't1)

                         (setf *initial-width* %width%)))

   :best-width 600))

 

(defmethod interface-display :after ((self test))

  (setf (layout-ratios (slot-value self 'l1))

        (list *initial-width*

              2

              (- (with-geometry self %width%) *initial-width*))))

 

(defun make-test ()

  (display (make-instance 'test)))

 

 

Best regards

 

Andreas

 

Updated at: 2020-12-10 08:41 UTC