| | 1. Do I just make an event that will translate into setting | | frame-needs-redisplay? | | | | I tried this approach in Lispworks CLIM and it seems to work pretty well.
It is even easier than I thought. Here is a refinement of yesterdays code.
Paul ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ (in-package :clim-user)
(defclass thing () ((x :initarg :x) (y :initarg :y)) (:default-initargs :x (random 100) :y (random 100)))
(define-application-frame a-test () ((things :initform nil)) (:pointer-documentation nil) (:menu-bar nil) (:panes (p1 :application :width 300 :height 200 :end-of-line-action :allow :display-function 'p1df :incremental-redisplay t)) (:layouts (default p1)))
(defun p1df (frame pane) (with-output-recording-options (pane :record t) (with-slots (things) frame (dolist (thing things) (with-slots (x y) thing (updating-output (pane :unique-id thing :cache-value (list x y) :cache-test #'equal) (draw-rectangle* pane x y (+ x 10) (+ y 10) :ink +blue+)))))))
(defvar *frame* nil)
(defun doit () ;; display A-TEST application (setq *frame* (make-application-frame 'a-test)) (run-frame-top-level *frame*))
(defclass my-event (device-event)() (:default-initargs :modifier-state 0))
(defmethod handle-event (client (event my-event)) (with-application-frame (frame) (redisplay-frame-pane frame client))))
(defun stuffit (frame) ;; do something to "update the database" (let ((tls (frame-top-level-sheet frame)) (pane (frame-standard-output frame))) (with-slots (things) frame (push (make-instance 'thing) things)) ;; Inform frame that something has changed (queue-event tls ;; :sheet causes event-handler client to be that (make-instance 'my-event :sheet pane))))