[racket] Problem with on-subwindow-event

From: Kieron Hardy (kieron.hardy at gmail.com)
Date: Mon Sep 24 18:00:44 EDT 2012

Hi all,

Considering the program below, does anyone know:

- Why do I get 3 enter messages when moving the mouse cursor into the
frame, and 2 enter messages when moving the mouse cursor into the list-box%?

- If (as I suspect) there is a call to on-subwindow-event for every
sub-component of a widget (i.e. 3 sub-components for a frame%, 2 for a
list-box%), how should I filter so that I only process the event once for
each component?

Thanks in advance,

Kieron.

****

#lang racket

(require racket/gui)

(define my-frame%
  (class frame%
    (super-new)
    (define/override (on-subwindow-event r e)
      (when (equal? (send e get-event-type) 'enter)
        (printf "enter ~a~n" (object-name r))))))

(define f (new my-frame%
               [label "test list-box"]
               [width 400]
               [height 200]))

(define l (new list-box%
               [parent f]
               [label "options"]
               [choices (list "apple" "pear" "cherry")]
               [stretchable-width #f]
               [stretchable-height #f]))

(send f show #t)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20120924/9aa7b4a9/attachment-0001.html>

Posted on the users mailing list.