[plt-scheme] editor behaviour

From: Ivanyi Peter (pivanyi at freemail.hu)
Date: Mon Jul 20 09:10:11 EDT 2009

 Robby Findler <robby at eecs.northwestern.edu> írta: 
 
 I don't think that there is any (intentional) buffering going on in
 those methods. Perhaps you could supply a (short) complete program
 that illustrates the problem? That would be a big help.
 
Hi Robby,

Ok I try to reproduce it. 
Until then here is another problem with the editor, that
I had noticed 
Execute the code below. Press any key in the window
four times, until the scroll bar is activated. The first
seven lines disappear and I cannot bring it back.
This is on Windows XP SP3, PLT-Scheme 4.2.

Best regards,

Peter Ivanyi

----------------------------------------------------------
#lang scheme

(require (lib "class.ss") 
         (lib "mred.ss" "mred")
         (lib "framework.ss" "framework") 
)


(define (sx-history-entry-new parent)
  (let*
    ( (editor (new text%))
      (canvas (new editor-canvas% (parent parent) 
                                  (editor editor)
                                  (style '(control-border))
              )
      )
    )
    ; we set the tab positions
    (send editor set-tabs '(100 200 300 400 500 600 700 800 900 1000 100) 1 #t)
    (send editor lock #t)
    (send editor hide-caret #t)
    (send canvas scroll-with-bottom-base #t)
    canvas
  )
)

(define (sx-history-entry-add window text)
  (let 
    ( (ed (send window get-editor)) )
    (send ed lock #f)
    (send ed move-position 'end #f 'simple)
    (send ed insert text)
    (send ed lock #t)
  )
) 


(letrec
  ((sx-history-window%
     (class frame%
       (define/override (on-subwindow-char window event)
         (display "bingo\n")
         (sx-history-entry-add ed "Hello World\n")
         #t
       )
       (super-instantiate ())
     )
   )
   (win (new sx-history-window% (label "test") (width 200) (height 200)))
   (ed (sx-history-entry-new win))
  )
  (send win show #t)
)




Posted on the users mailing list.