[Prev][Next][Index][Thread]

Re: Deuce gadgets and streams



"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);

I was a bit overwhelmed by the size of Duece at first, but the more I
dig into it, the more I like it.

Chris.
-- 
http://www.double.co.nz/dylan




Follow-Ups: References: