[Prev][Next][Index][Thread]
Re: Deuce gadgets and streams
Chris Double wrote in message ...
>"Scott McKay" <swm@mediaone.net> writes:
>
>> Take a look at dylan/sources/deuce/streams.dylan, and you'll see
>> that you can create a stream over buffers or regions within a
>> buffer.
>
>Thanks Scott, that was a big help! I wanted the streamed text to
>appear at the top of the gadget, moving the rest down and the
>following example code is how I got it working (based on the code
>snippet you showed):
>
> // deuce module imported with prefix "deuce/" to prevent
> // name clashes.
> //
> let gadget :: <deuce-gadget> = ...; // obtained from frame
> let buffer = deuce/window-buffer(gadget);
> let stream =
> make(deuce/<interval-stream>,
> direction: #"output",
> interval: make(deuce/<interval>,
> start-bp: deuce/interval-start-bp(buffer),
> end-bp: deuce/interval-start-bp(buffer)));
>
> write-line(stream, "test line");
> close(stream);
>
> deuce/queue-redisplay(gadget, deuce/$display-all);
> deuce/redisplay-window(gadget);
Hmm, I forgot that you needed to tell it to redisplay the window
after doing stream output, but I can see why I didn't make that
happen automagically -- it would slow down stream operations
to be asking for redisplay all the time.
I'm glad it worked!
>I was a bit overwhelmed by the size of Duece at first, but the more I
>dig into it, the more I like it.
Yeah, Deuce started out pretty small, but the more we started
using it as the primary editor for the environment, the more I
had to make it a real editor. I'll certainly take any compliment
from you, though!
References: