make double-clicking in the list box for the "Open Collection Path..."

menu item work
This commit is contained in:
Robby Findler 2014-07-04 19:02:58 -05:00
parent d9dae651fd
commit 0ae42ae401

View File

@ -48,7 +48,12 @@
(define lb (new list-box%
[style (if dir? '(extended) '(single))]
[parent dlg] [choices '()] [label #f]
[callback (λ (lb evt) (update-buttons))]))
[callback (λ (lb evt)
(cond
[(equal? (send evt get-event-type) 'list-box-dclick)
(handle-list-box-double-click)]
[else
(update-buttons)]))]))
(define different-racket-panel
(new vertical-panel%
@ -212,7 +217,7 @@
[else
(define item-to-act-on (get-item-to-act-on))
(cond
[item-to-act-on
[item-to-act-on
(define datum (send lb get-data item-to-act-on))
(cond
[(path? datum)
@ -225,6 +230,23 @@
(send ok-button enable #f)
(send enter-sub-button enable #f)])]))
(define (handle-list-box-double-click)
(cond
[dir?
(ok)]
[else
(define item-to-act-on (get-item-to-act-on))
(cond
[item-to-act-on
(define datum (send lb get-data item-to-act-on))
(cond
[(path? datum)
(ok)]
[(string? datum)
(enter-sub)])]
[else
(void)])]))
(define (get-item-to-act-on)
(or (send lb get-selection)
(and (<= 1 (send lb get-number))
@ -342,3 +364,7 @@
(preferences:set-default 'drracket:get-module-path-from-user-size
(list 600 600)
(list/c exact-nonnegative-integer? exact-nonnegative-integer?))
(module+ main
(get-module-path-from-user))