.
original commit: d345c15ae070713df4dbf7bcacd648b42c25761b
This commit is contained in:
parent
a26f432e8f
commit
26147e891a
|
@ -158,7 +158,7 @@
|
|||
m)
|
||||
last-m)])
|
||||
(set! last-m m)
|
||||
(popup-menu m x y))))])
|
||||
(popup-menu m (inexact->exact x) (inexact->exact y)))))])
|
||||
(sequence
|
||||
(apply super-init args))))
|
||||
|
||||
|
@ -987,13 +987,21 @@
|
|||
(let ([e (make-object control-event% 'radio-box)])
|
||||
(send rb set-selection p)
|
||||
(send rb command e))))
|
||||
(define (mk-err exn?)
|
||||
(lambda (f)
|
||||
(lambda (rb p)
|
||||
(with-handlers ([exn? void])
|
||||
(f rb p)
|
||||
(error "no exn raisd")))))
|
||||
(define type-err (mk-err exn:application:type?))
|
||||
(define mismatch-err (mk-err exn:application:mismatch?))
|
||||
|
||||
(define do-sel (lambda (sel n) (for-each (lambda (rb) (sel rb (n rb))) rbs)))
|
||||
(define sel-minus (lambda (sel) (do-sel sel (lambda (rb) -1))))
|
||||
(define sel-minus (lambda (sel) (do-sel (type-err sel) (lambda (rb) -1))))
|
||||
(define sel-first (lambda (sel) (do-sel sel (lambda (rb) 0))))
|
||||
(define sel-middle (lambda (sel) (do-sel sel (lambda (rb) (floor (/ (send rb get-number) 2))))))
|
||||
(define sel-last (lambda (sel) (do-sel sel (lambda (rb) (sub1 (send rb get-number))))))
|
||||
(define sel-N (lambda (sel) (do-sel sel (lambda (rb) (send rb get-number)))))
|
||||
(define sel-N (lambda (sel) (do-sel (mismatch-err sel) (lambda (rb) (send rb get-number)))))
|
||||
(define (make-selectors title sel)
|
||||
(define hp2 (make-object horizontal-panel% p))
|
||||
(send hp2 stretchable-height #f)
|
||||
|
|
|
@ -19,9 +19,10 @@ Click "Select First", "Select Middle", "Select Last" then
|
|||
in all radioboxes each time. (For the two-button box, the
|
||||
second one counts as `middle'.)
|
||||
|
||||
Click "Select -1" and "Select N". Nothing should happen. Select the
|
||||
last button in each box and try "Select -1" again. Nothing
|
||||
should happen. Return the selection to the first item in each box.
|
||||
Click "Select -1" and "Select N". Nothing should happen (because the
|
||||
appropriate exceptions are caught). Select the last button in each
|
||||
box and try "Select -1" again. Nothing should happen. Return the
|
||||
selection to the first item in each box.
|
||||
|
||||
Repeat the two steps for the "Select XXX by Simulate" buttons. In this
|
||||
case, "Callback Ok" should be printed three times when any button
|
||||
|
|
Loading…
Reference in New Issue
Block a user