Hi Andy,
thanks for your post, your insight and the explanations saved me hours! You're right about the confusion on my part about incremental redisplay. I thought it is a generic term and didn't exactly understand the way it is implemented in clim. I found out about the mechanism of updating-output yesterday and got a working example (and a vague idea, how it works internally). The mechanism is amazing and can probably save lots of coding time, but it might be a little too expensive. IIUC a redisplay function has to traverse all output records in order to find out which ones have changed. That might be too inefficient when doing redraws of changing records during pointer-motion, but I'll see about that.
I will also check your suggestions about window redrawing. I found out that a call to force-output on the pane will do the redraw on my system (Linux/X11).
-- Orm
Am Dienstag, den 05. Mai 2009 um 04:30:52 Uhr (+0000) schrieb Andy Hefner:
On Mon, May 4, 2009 at 8:08 AM, Orm Finnendahl o.finnendahl@mh-freiburg.de wrote:
Hi,
still working on my specialized browser I'm starting to implement the gui part of the application. Three questions:
- Can I update (redraw) a pane without activating it with the mouse?
"(window-refresh pane)" doesn't actually draw unless the window gets activated in the window-manager).
That sounds very odd. I could speculate at causes, but McCLIM's definition of window-refresh looks suspect anyway. I recommend using (repaint-sheet stream (window-viewport stream)) instead of window-refresh. Possibly there's a buffering issue, but in most circumstances McCLIM takes care of that for you. Try calling finish-output on the stream after drawing.
- How can I implement scrolling in the pane? The scroll bars are there
but they don't get updated if I draw off the visible region of the pane.
After drawing on the pane, at some point the pane has to be resized to fit the output. McCLIM tries to do this itself at appropriate times (such as at the end of lines of text, after calling the display function, or table/graph formatting), but this is somewhat expensive so the various drawing functions don't do it automatically. In particular, if you're working outside the normal paradigm of display functions, you might have to do this manually. One way is to call change-space-requirements on the pane with a width determined from the bounding rectangle of the stream-output-history. A shorter way is to call climi::fit-pane-to-output, which is what mcclim calls internally.
- Is there a straightforward way to get a reference to an output
record upon creation of the output record (to store it in the object which gets presented)?
with-output-as-presentation returns the output record of the presentation. If you mean it's the output record of the drawn lines you want, I don't know of a good way of obtaining those as such. What I do is to draw things inside with-new-output-record, which will return a standard-sequence-output-record containing your drawing, then come back and add/remove things from this record or delete it altogether.
Maybe I'm doing it wrong by trying to access the output records themselves. This is the idea: I want to present graphical objects and change the shape of some of them using incremental redisplay. As far as I see, this should be done by deleting the respective output record and redrawing it with the new properties.
I do this sort of thing all the time (directly manipulating output records) and it's a powerful approach. Incremental redisplay is a higher level facility intended to spare you from the lower level details of dealing directly with output records, using updating-output to handle caching and update of sections of the output. There might be some confusion of terminology here. Perhaps using the higher level facilities will make things simpler. I personally always go the lower level route that you seem to be taking (mostly because I understand the output recording code quite well and like to maintain complete control), but other software like Climacs and the inspector have used incremental redisplay to good effect.