on-redisplay

Generic Function

Package: common-graphics

Arguments: drawable

Returns (or sets with setf) the value of the on-redisplay event property of the argument. The value should be a function object or a function name (a symbol naming a function). This function will be called by the default redisplay-event method whenever a drawable needs to be redrawn, such as when it is uncovered. Note that if the default redisplay-event method is overridden, then the on-redisplay will not be called by it. If the value of the on-redisplay property is nil, then no function is called.

The on-redisplay function should take two arguments, (1) the drawable control and (2) the stream to draw on. If the use-bitmap-stream property of the control is true, then the stream argument will be the bitmap-stream of the control; otherwise it will be the visible window of the control. The on-redisplay function should draw whatever it draws on the stream object; if this is a bitmap-stream, then the drawable will automatically quickly copy what was drawn there to the visible window.

Here is the sample on-redisplay function that is used initially by a drawable control when it is interactively instantiated onto a form in the IDE. This should of course be replaced by some other function more appropriate to the application. Note that it draws its drawing to fit the current page size of the drawable.

(defun on-redisplay-example (drawable stream)
   (declare (ignore drawable))
   (let* ((width (page-width stream))
          (height (page-height stream))
          (mid (floor width 2))
          (num-lines 24)
          (factor (float (/ width (1- num-lines))))
          )
      (dotimes (j num-lines)
         (draw-line stream
           (nmake-position #.(make-position 0 0) mid height)
           (nmake-position #.(make-position 0 0)
             (round (* j factor)) 0)))))

on-redisplay is a property of the drawable class.

Common Graphics and IDE documentation is described in About Common Graphics and IDE documentation in cgide.htm. See also About event handling in the IDE in that document.

The documentation is described in introduction.htm and the index is in index.htm.

Copyright (c) 1998-2000, Franz Inc. Berkeley, CA., USA. All rights reserved.

Created 2000.10.5.