Generic FunctionPackage: cgToCDocOverviewCGDocRelNotesFAQIndexPermutedIndex
Allegro CL version 8.2
Unrevised from 8.1 to 8.2.
8.1 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 8.2. This page was not revised from the 8.1 page.
Created 2010.1.21.

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