[plt-scheme] Re: scrolling inside an editor-snip?

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Mon Oct 8 07:08:15 EDT 2007

At Sun, 07 Oct 2007 17:58:52 -0000, harsha wrote:
> The new snip-admin% class instead of passing on the scroll request
> must ask the new editor-snip% class to scroll down. So the new editor-
> snip% class must have a scroll-to method similar to the scroll-to
> method in editor-canvas%. Both editor-snip% and editor-canvas% are
> displays for text%, but editor-snip% is missing the scroll-to method.
> 
> My question is how does one write this scroll-to method for the new
> editor-snip% class? There seems to be no way of doing this using
> mred's commands directly. The only way i can think of is to look at
> the source of the editor-canvas%'s scroll-to method and writing a
> similar method for editor-snip%. Is there some more direct way to copy
> the scroll-to method of the editor canvas% class?

I'm not entirely sure what you mean...

The editor-snip%'s `draw' method is ultimately responsible for drawing
the nested text%. So, you need to extend `editor-snip%' to keep track
of a scroll offset for the nested text% (as set through `scroll-to'
calls), and then override `draw' to send a suitable `refresh' call to
the nested text% (to draw only the visible part, and with an offset
that starts drawing at the right line).

So, in the sense that there's nothing like a scroll offset already
built into editor-snip%, then there isn't already a way to do this in
MrEd. But I think all the pieces are in place for implementing a
virtual-scroll-managing `scroll-to' and `draw' by extending
editor-snip%.

Matthew



Posted on the users mailing list.