[mcclim-devel] bug: text-field gadget

Paul Werkowski pw at snoopy.mv.com
Sat Apr 22 13:05:42 UTC 2006


In gadgets.lisp there is this comment:

;; Is there really a benefit to waiting until the first painting to
;; create the goatee instance? Why not use INITIALIZE-INSTANCE?
(defmethod handle-repaint :before ((pane text-field-pane) region)

<...>

and this method:

(defmethod (setf gadget-value) :after (new-value (gadget text-field-pane)
           &key invoke-callback)
  (declare (ignore invoke-callback))
  (let* ((area (area gadget))                 ;;;<<<< NIL
           (buffer (goatee::buffer area))
           (start (goatee::buffer-start buffer))
           (end (goatee::buffer-end buffer)))
    (goatee::delete-region buffer start end)
    (goatee::insert buffer new-value :position start)
    (goatee::redisplay-area area)))

which fails when (setf gadget-value) is called before the text-field is
displayed on screen.
Result is dreaded NO-APPLICABLE-METHOD signal.

The work around is obvious. I'll get the gadgetmeisters figure out the correct
solution.

A test case is below.

Paul
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
(in-package :clim-user)

(define-application-frame testme ()
  ((tfg))
  (:panes
   (p0 :application
       :display-function
       (lambda (f p)
         (with-slots (tfg) f
           (with-output-as-gadget (p :cache-value t)
             (with-look-and-feel-realization ((frame-manager f) f)
               (setq tfg (make-pane 'text-field :width 40))))
           (setf (gadget-value tfg) "XXX")))))
  (:layouts
   (default p0)))

(defun testme ()
  (run-frame-top-level
   (make-application-frame 'testme)))





More information about the mcclim-devel mailing list