Lisp HUG Maillist Archive

Persistent output-pane plist

A new interface instance retains a plist property I set in a previous 
instance.

The interface includes an output-pane which uses a plist property to
store text for display. If I setf the property, a second instance of the
interface retains the plist property from the first instance.  If the
output-panes are created using contain, this persistence isn't seen.

If the plist is set to nil in the define-interface, all is as expected.

How does the new instance even know about the previous instance? Thank 
you for any insight.

Mitch

(capi:define-interface test-plist ()
   ()
   (:panes
    (test-pane
     capi:output-pane
     :accessor test-pane
     :plist '(:text nil)
     :display-callback 'draw-text-pane))
   (:layouts
   (main-layout
    capi:column-layout
    '(test-pane)))
   (:default-initargs
    :layout 'main-layout
    :best-width 100
    :best-height 20))

(defun draw-text-pane (pane x y width height)
   (declare (ignore x y width height))
   (gp:clear-graphics-port pane)
   (gp:draw-string pane (capi:capi-object-property pane :text) 10 10))

(defun set-text-property (pane string)
   (setf (capi:capi-object-property pane :text) string)
   (draw-text-pane pane nil nil nil nil))

(defun test-persist ()
   (capi:display (make-instance 'test-plist)))

> (setf interface1 (test-persist))
> (capi:apply-in-pane-process interface1 #'set-text-property (test-pane interface1) "hello")
> (setf interface2 (test-persist))


Re: Persistent output-pane plist

On Thu, 07 Feb 2008 11:37:53 -0500, Mitch Berkson <mitch@bermita.com> wrote:

>      :plist '(:text nil)

That's the classical newbie bug of modifying literal objects - see
Lisp FAQ.  Change that to

       :plist (list :text nil)

and you should be set.

Edi.


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