[racket] list-box%: cannot click on first item

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Thu Sep 12 20:53:19 EDT 2013

When I run the program, the first item is selected initially on
Unix/Gtk. Clicking the item doesn't change the selection, and so the
callback isn't triggered.

If I add

 (send lb select 0 #f)

before showing the frame, then the first item is not selected when the
frame appears, and clicking the first item triggers the callback.

I see that no item is initially selected on Mac OS X and Windows, so it
makes sense to change Unix/Gtk to be more consistent. In fact, the
current Gtk binding for `list-box%` goes out of its way to make
something selected, so I can easily disable it. I've pushed the change.

Does that sound right?

At Thu, 12 Sep 2013 15:59:29 +0200, Laurent wrote:
> In a list-box% containing only 1 item, clicking on the item does not
> trigger the callback (Ubuntu 13.04).
> Is it the same on other platforms?
> Does anyone know any way around this, or a way to fix this?
> Thanks,
> Laurent
> Example:
> #lang racket/gui
> (define my-frame (new frame% [label "my-frame"]
>                       [min-width 200] [min-height 200]))
> (define lb (new list-box% [parent my-frame]
>                 [label "values"]
>                 [choices '("a")]
>                 [callback (λ(lb ev)
>                             (displayln "Callback called."))]))
> (send my-frame show #t)
> ; Then try to click on "a"
> ____________________
>   Racket Users list:
>   http://lists.racket-lang.org/users

Posted on the users mailing list.