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

Re: Simple scrolling windows for text



In article <59a8c9ddb.000fb61@kirk.engin.umich.edu>, kieras@engin.umich.edu
(David Kieras) wrote:
> 
> I need to be able to create simple windows to write text into, that have scroll bars
> and will automatically scroll so that the last information written into them is visible.
> There is no need for editing functions, but being able to save it as a file would be
> good.  It looked like simply creating a fred window was adequate, but it does not
> scroll automatically, so you can only see the last written information by manually
> scrolling it.  The listener window behaves the right way.  Scanning the documentation,
> and comparing a fred window with a listener window in the inspector doesn't turn up
> anything obvious. Note that the scrolling-windows in "examples" has the same problem.
> 
> Any suggestions?
> 
> Thanks!

You only have to redefine stream-tyo to check whether the window should be
scrolled. Try something like:

(defclass *show-window* (Fred-Window)
  ()
  )

(Defmethod Einfuege-Cursor-Sichtbar-P ((Ich *show-window*))
  "insertion point visible"
  (> (fred-vpos ich (buffer-position (fred-buffer ich))) 0))

(Defmethod Stream-Tyo ((Ich *show-window*) Zeichen)
  (Apply #'Call-Next-Method Ich (List Zeichen))
  (When (Eql (Stream-Column ich) 0)
    (Unless (Einfuege-Cursor-Sichtbar-P Ich) 
      (Sichtbare-Position-Fuer-Cursor-Setzen Ich))
    (Fred-Update Ich)))


(Defmethod Sichtbare-Position-Fuer-Cursor-Setzen ((Ich *show-window*))
  (Let ((Alte_Position_Oben (Buffer-Position (Fred-Display-Start-Mark
Ich)))
        (Cursor_Position (Buffer-Position (Fred-Buffer Ich))))
    (Declare (Ignore Alte_Position_Oben))
    (Set-Mark (Fred-Display-Start-Mark Ich) Cursor_Position)))


; Example

(Let ((Fenster (Make-Instance ' *show-window*)))
  (Dotimes (X 40)
    (print `(,x test ,(* 2 x) this is a nasty test message ,x) fenster))
  )



Karsten Poeck