[plt-scheme] Text% getting and setting text, images, etc.
At Fri, 14 Mar 2003 15:08:01 +0100, Erich Rast wrote:
> I need to re-implement all insert/copy/paste/undo/redo operations in a
> text% subclass. However, I haven't yet figured out how to get and
> insert editor data that may contain more than just text. Does
> "flattened text" include subeditors and images? How would I insert
> "flattened text" into the editor again?
>
> I shouldn't really use on-copy and on-paste, because I also need to
> save ranges of editor data for my own custom undo scheme. So what I'd
> need is something like:
>
> (get-rich-text start-position end-position) ==> rich text data or
> whatever
> (insert-rich-text text-data position)
>
> How to?
You need to work with snip% objects instead of strings. If you want
things marshalled, try working with the `write-to-file' method of text%
(which, despite its name, doesn't necessarily write to a file).
Matthew