original commit: 0ebde16a0f431e73b7f7a4fe7d01b65f936b6e84
This commit is contained in:
Matthew Flatt 1998-07-09 18:09:59 +00:00
parent b916a312c7
commit 82db08511e
2 changed files with 30 additions and 13 deletions

View File

@ -195,11 +195,13 @@ Multiple Selections >> Multiple-Selection Lists Only <<
-------------------
Click on each of the three items and make sure that "Selected N"
and "Callback Ok" are printed in the console.
and "Callback Ok" are printed in the console. (For most platforms
selecting an item deselects the other items, but some platforms
preserve the old selections. That's ok.)
Click "Check" and verify the item list *and* the selection list. Only
one item should be selected, and the only position of that item
(counting frmo 0) should be in the selection list.
(counting from 0) should be in the selection list.
Use the shift key to select a second item. The console should show
"Selected N" and "Callback Ok" as usual.
@ -215,6 +217,14 @@ Shift-click to select the remaining item. The console should show
Control-click on a selected item. It should become unselected (and the
other two selected items should remain so). The console should report
"Selected -1", "Deselect", and "Callback Ok".
"Deselected N" and "Callback Ok".
Click "Check" and verify the selection list.
...
Simulate should act like clicking, either extending the selection or
restarting it.
Drag and make sure each selection/desel causes a notification.

View File

@ -906,7 +906,8 @@
(list wx:const-event-type-listbox-command)
(list wx:const-event-type-choice-command)))
(define old-list null)
(define multi? (= list-style wx:const-multiple))
(define multi? (or (= list-style wx:const-multiple)
(= list-style wx:const-extended)))
(define callback
(lambda (cx e)
(when (zero? (send c number))
@ -915,15 +916,19 @@
(send e get-command-int)
(send e get-command-string))
old-list))
(printf "Selected ~a~n" (send e get-command-int))
(cond
[(and multi? (= -1 (send e get-command-int)))
[(= 0 (send e get-extra-long))
; deselection
(unless (= -1 (send e get-command-int))
(error "selection index is not -1"))
(unless (null? (send e get-command-string))
(error "string selection not null:" (send e get-command-string)))
(printf "Deselect~n")]
(printf "Deselected ~a~n" (send e get-command-int))
(unless multi?
(error "delselection in a single-selection list"))
(unless (< -1 (send e get-command-int) (length actual-content))
(error "deselection index is out of range"))
(unless (not (memv (send e get-command-int) (send c get-selections)))
(error "deselected item is actually selected"))
(unless (string=? (send e get-command-string)
(send c get-string (send e get-command-int)))
(error "string selection mismatch:" (send e get-command-string)))]
[(= 2 (send e get-extra-long))
; double-click
(unless (= -1 (send e get-command-int))
@ -933,6 +938,7 @@
(printf "Double-click~n")]
[else
; selection
(printf "Selected ~a~n" (send e get-command-int))
(if (or (not multi?) (<= (length (send c get-selections)) 1))
(begin
(unless (= (send e get-command-int)
@ -1092,7 +1098,7 @@
(send e set-command-string
(if (< -1 p (length actual-content))
(list-ref actual-content p)
"???"))
null))
(when list? (send c set-first-item p))
(send c command e)))
" by Simulate" #t))
@ -1313,7 +1319,8 @@
(send lp stretchable-in-x #f)
(make-object mred:button% lp (lambda (b e) (choice-or-list-frame #t wx:const-single #f)) "Make List Frame")
(make-object mred:button% lp (lambda (b e) (choice-or-list-frame #t wx:const-single #t)) "Make Empty List Frame")
(make-object mred:button% lp (lambda (b e) (choice-or-list-frame #t wx:const-multiple #f)) "Make Multilist Frame")
(make-object mred:button% lp (lambda (b e) (choice-or-list-frame #t wx:const-multiple #f)) "Make MultiList Frame")
(make-object mred:button% lp (lambda (b e) (choice-or-list-frame #t wx:const-extended #f)) "Make MultiExtendList Frame")
(make-object mred:button% ap (lambda (b e) (gauge-frame)) "Make Gauge Frame")
(define tp (make-object mred:horizontal-panel% ap))
(send tp stretchable-in-x #f)