From 00124220bdd7c8b67579da50d03cda2c0fb9cfce Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Fri, 31 Dec 2010 09:41:10 -0700 Subject: [PATCH] fix platform-independent file dialog --- collects/mred/private/path-dialog.rkt | 35 +++++++++++++++------------ 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/collects/mred/private/path-dialog.rkt b/collects/mred/private/path-dialog.rkt index 3a44ef8d44..219919606d 100644 --- a/collects/mred/private/path-dialog.rkt +++ b/collects/mred/private/path-dialog.rkt @@ -685,26 +685,29 @@ (make-object message% (protect& message) p))) (define dir-text - (let ([c (class (if win? combo-field% text-field%) (super-new) + (let* ([c% + (if win? + (class combo-field% + (super-new [choices '()]) + (define/override (on-popup e) + (let ([m (send this get-menu)]) + (for-each (lambda (i) (send i delete)) + (send m get-items)) + (for-each (lambda (r) + (define l (path->string r)) + (make-object menu-item% l m + (lambda _ + (enter-text r) + (do-enter)))) + (filesystem-root-list))))) + text-field%)] + [c (class c% + (super-new) (define editor (send this get-editor)) (define/public (lock) (send editor lock #t)) (define/public (unlock) (send editor lock #f)) - (define/override (on-popup e) - (when win? - (let ([m (send this get-menu)]) - (for-each (lambda (i) (send i delete)) - (send m get-items)) - (for-each (lambda (r) - (define l (path->string r)) - (make-object menu-item% l m - (lambda _ - (enter-text r) - (do-enter)))) - (filesystem-root-list))))) (lock))]) - (if win? - (new c [label #f] [parent this] [init-value ""] [choices '()]) - (new c [label #f] [parent this] [init-value ""])))) + (new c [label #f] [parent this] [init-value ""]))) (define path-list (new (class list-box%