[plt-scheme] MrEd: creating an inactive child

From: Doug Orleans (dougo at ccs.neu.edu)
Date: Wed Dec 4 03:30:31 EST 2002

Pat Ekman writes:
 > Use (send parent begini-container-sequence) before and (send parent
 > end-container-sequence) after you make changes to its children.  This
 > will keep it from recalculating its geometry until you're finished.

I do use those, and that doesn't prevent the display from updating if
the display thread gets to run in between the begin-container-sequence 
and end-container-sequence:

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

(define frame 
  (parameterize ((current-eventspace (make-eventspace)))
    (make-object frame% "Test")))

(define m1 (make-object message% "1" frame))
(define m2 (make-object message% "2" frame))
(define m3 (make-object message% "3" frame))
(send frame show #t)

(define m4 #f)
(define (test)
  (send frame begin-container-sequence)
  (set! m4 (make-object message% "4" frame))
  (sleep 2)
  (send frame delete-child m4)
  (send frame change-children
	(lambda (children) (list m1 m2 m4)))
  (send frame end-container-sequence))

Each time test is run, the 4 shows up at the top for 2 seconds.
I suppose I could wrap the whole sequence in a semaphore, but this is
starting to be way too much work...

--dougo at ccs.neu.edu

Posted on the users mailing list.