Generic Function | Package: cg | ToC | DocOverview | CGDoc | RelNotes | FAQ | Index | PermutedIndex
| Allegro CL version 10.1 Unrevised from 10.0 to 10.1. 10.0 version

## on-redisplay

Arguments: drawable-or-split-bar

### For a 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.

### For a split-bar

Returns the on-redisplay property of a `split-bar` widget. The value may be set at creation time by passing the `:on-redisplay` initarg to make-instance, or any time later by call (setf on-redisplay).

The value of this property should be the name of a function that will be called when needed to draw the `split-bar`, or else `nil` to draw the split-bar in the default way. The default value is `nil`. You may use setf to set the value of this property.

When `nil`, the `split-bar` is drawn as a simple colored line according to the color-when-idle, color-under-mouse, or color-when-dragging property.

When a function, the function should accept two arguments, which will be the split-bar dialog-item itself and the associated `split-bar-pane` widget-window. Drawing functions should be called on the `split-bar-pane` to draw the widget. The function would typically draw somewhat differently depending on whether the now-dragging and now-under-mouse properties of the split-bar are true.

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

Copyright (c) 1998-2022, Franz Inc. Lafayette, CA., USA. All rights reserved.
This page was not revised from the 10.0 page.
Created 2019.8.20.

|  | ToC | DocOverview | CGDoc | RelNotes | FAQ | Index | PermutedIndex
| Allegro CL version 10.1 Unrevised from 10.0 to 10.1. 10.0 version