Generic FunctionPackage: cgToCDocOverviewCGDocRelNotesFAQIndexPermutedIndex
Allegro CL version 9.0
Unrevised from 8.2 to 9.0.
8.2 version


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.

See cg-events.htm for information about event handling in Common Graphics.

Copyright (c) 1998-2012, Franz Inc. Oakland, CA., USA. All rights reserved.
Documentation for Allegro CL version 9.0. This page was not revised from the 8.2 page.
Created 2012.5.30.

Allegro CL version 9.0
Unrevised from 8.2 to 9.0.
8.2 version