All Manuals > Common Lisp Interface Manager 2.0 User's Guide > Chapter 14 Output Recording and Redisplay

NextPrevUpTopContentsIndex

14.6 Example of Incremental Redisplay in CLIM

The following function illustrates the standard use of incremental redisplay:

(defun test (stream) 
  (let* ((list (list 1 2 3 4 5)) 
         (record
          (clim:updating-output
           (stream)
           (do* ((elements list (cdr elements)) 
                 (count 0 (1+ count)) 
                 (element (first elements) (first elements)))
               ((null elements)) 
             (clim:updating-output (stream :unique-id count
                                           :cache-value element)
                                   (format stream "Element ~D~%" element)))))) 
    (force-output stream)
    (sleep 10)
    (setf (nth 2 list) 17)
    (clim:redisplay record stream))) 

When test is run on a window, the initial display looks like:

  Element 1 
  Element 2 
  Element 3
  Element 4 
  Element 5 

After the sleep has terminated, the display looks like:

 
  Element 1 
  Element 2 
  Element 17
  Element 4 
  Element 5 

Incremental redisplay takes care of ensuring that only the third line gets erased and redisplayed. In the case where items have moved around, Incremental Redisplay ensures that the minimum amount of work is done in updating the display, thereby minimizing "flashiness" while providing a powerful user interface. For example, try substituting the following for the form after the sleep:

 
(setf list (sort list #'(lambda (&rest args) (zerop (random 2)))))

Common Lisp Interface Manager 2.0 User's Guide - 7 Aug 2017

NextPrevUpTopContentsIndex