[mcclim-devel] three questions

Andy Hefner ahefner at gmail.com
Tue May 5 04:30:52 UTC 2009


On Mon, May 4, 2009 at 8:08 AM, Orm Finnendahl
<o.finnendahl at 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.




More information about the mcclim-devel mailing list