Page 179 Table of Contents Index Page 181
Chapters
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30
A, B, C, D, E



CHAPTER 21. INCREMENTAL REDISPLAY

help CLIM out.

21.1.1 Examples of Incremental Redisplay

The usual technique of incremental redisplay is to use updating-output to inform CLIM what
output has changed, and use redisplay to recompute and redisplay that output.

The outermost call to updating-output identifies a program fragment that produces incremen-
tally redisplayable output. A nested call to updating-output (that is, a call to updating-
output
that occurs during the execution of the body of the outermost updating-output and
specifies the same stream) identifies an individually redisplayable piece of output, the program
fragment that produces that output, and the circumstances under which that output needs to
be redrawn. This nested calls to updating-output are just hints to incremental redisplay that
can reduce the amount of work done by CLIM.

The outermost call to updating-output executes its body, producing the initial version of the
output, and returns an incremental redisplay record that captures the body in a closure. Each
nested call to updating-output stores its :unique-id and :cache-value arguments and the
portion of the output produced by its body.

redisplay takes an incremental redisplay record and executes the captured body of updating-
output
over again. When a nested call to updating-output is executed during redisplay,
updating-output decides whether the cached output can be reused or the output needs to
be redrawn. This is controlled by the :cache-value argument to updating-output. If its value
matches its previous value, the body would produce output identical to the previous output and
thus is unnecessary. In this case the cached output is reused and updating-output does not ex-
ecute its body. If the cache value does not match, the output needs to be redrawn, so updating-
output
executes its body and the new output drawn on the stream replaces the previous output.
The :cache-value argument is only meaningful for nested calls to updating-output.

In order to compare the cache to the output record, two pieces of information are necessary: Normally, the programmer would supply both options. The unique-id would be some data
structure associated with the corresponding part of output. The cache value would be something
in that data structure that changes whenever the output changes.

It is valid to give the :unique-id and not the :cache-value. This is done to identify a parent
in the hierarchy. By this means, the children essentially get a more complex unique id when
they are matched for output. (In other words, it is like using a telephone area code.) The cache
without a cache value is never valid. Its children always have to be checked.


Page 179 Table of Contents Index Page 181
Chapters
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30
A, B, C, D, E