PasteRack.org
Paste # 42973
2019-10-01 20:34:22

Fork as a new paste.

Paste viewed 383 times.


Embed:

#lang racket/gui

(define f (new frame% [label "lb test"]))
(define lb (new list-box%
                [label "listbox"]
                [choices '("one" "two" "three")]
                [parent f]
                [callback (lambda (lb e)
                            (printf "selected: ~a~n" (send lb get-string-selection)))]))
(send f show #t)

;; per: https://docs.racket-lang.org/gui/list-box_.html
;;  "The control’s callback procedure is not invoked."
(send lb select 0)

;; per: https://docs.racket-lang.org/gui/list-control___.html
;;  "The control’s callback procedure is not invoked when this method is called."
(send lb set-selection 1)
(send lb set-selection 2)