Hi all,<br><br>I have some sort of blocking issue in the code below (from Ryan Culpepper&#39;s helpful answer on SO at <a href="http://stackoverflow.com/questions/7294117/racket-using-events-in-a-frame-window">http://stackoverflow.com/questions/7294117/racket-using-events-in-a-frame-window</a>).<br>
<br>When the frame has keyboard focus, the arrow keys cause the direction to be printed in the canvas. When the on-char event is extended with a sleep (of one second), loading up the queue with a number of left,right,up,down key-stroke sequences causes the canvas to be updated at one second intervals.<br>
<br>Since the on-char procedure queues the actual processing (i.e. the &#39;update display and wait&#39; thunk) to run in an auxiliary eventspace, the frame can be moved and closed while key-stroke processing proceeds.<br>
<br>However, on Windows, moving the frame around causes the key-stroke processing to block until the move is completed. i.e. The &#39;update display and wait&#39; code blocks until the the mouse button is released.<br><br>
Anyone know, what might be causing the block, and if there any modifications that can be made to the code so that if does not occur?<br><br>Cheers, <br><br>Kieron.<br><br>****<br><br>#lang racket/gui<br><br>(define game-canvas%<br>
  (class canvas%<br>    (inherit get-width get-height refresh)<br><br>    ;; direction: one of #f, &#39;left, &#39;right, &#39;up, &#39;down<br>    (define direction #f)<br><br>    (define aux-eventspace (make-eventspace))<br>
<br>    (define/override (on-char ke)<br>      (parameterize ((current-eventspace aux-eventspace))<br>        (queue-callback<br>          (lambda ()<br>            (case (send ke get-key-code)<br>              ((left right up down)<br>
                 (set! direction (send ke get-key-code))<br>                 (refresh))<br>               (else <br>                 (void)))<br>            (sleep 2)))))<br><br>    (define/private (my-paint-callback self dc)<br>
      (let ([w (get-width)]<br>            [h (get-height)])<br>        (when direction<br>          (let ([dir-text (format &quot;going ~a&quot; direction)])<br>            (let-values ([(tw th _ta _td) (send dc get-text-extent dir-text)])<br>
              (send dc <br>                    draw-text<br>                    dir-text <br>                    (max 0 (/ (- w tw) 2))<br>                    (max 0 (/ (- h th) 2))))))))<br><br>    (super-new <br>      (paint-callback <br>
        (lambda (c dc) <br>          (my-paint-callback c dc))))))<br><br>(define game-frame (new frame% (label &quot;game&quot;) (width 600) (height 400)))<br>(define game-canvas (new game-canvas% (parent game-frame)))<br>
(send game-frame show #t)<br><br>