diff --git a/collects/mred/private/messagebox.rkt b/collects/mred/private/messagebox.rkt index 38733d0ffb..e0de7fcabf 100644 --- a/collects/mred/private/messagebox.rkt +++ b/collects/mred/private/messagebox.rkt @@ -46,15 +46,19 @@ who title message button1 button2 button3 parent style close-result - check? two-results? check-message))]) - (if (eq? (current-thread) (wx:eventspace-handler-thread (wx:current-eventspace))) + check? two-results? check-message))] + [es (if parent + (send parent get-eventspace) + (wx:current-eventspace))]) + (if (eq? (current-thread) (wx:eventspace-handler-thread es)) ;; In the right thread: (go) ;; Not in the right thread: (let ([ch (make-channel)]) - (wx:queue-callback - (lambda () - (channel-put ch (call-with-values go list)))) + (parameterize ([wx:current-eventspace es]) + (wx:queue-callback + (lambda () + (channel-put ch (call-with-values go list))))) (apply values (channel-get ch))))))) (define create-message-box/custom diff --git a/collects/scribblings/gui/dialog-funcs.scrbl b/collects/scribblings/gui/dialog-funcs.scrbl index 794e533449..d6300abc07 100644 --- a/collects/scribblings/gui/dialog-funcs.scrbl +++ b/collects/scribblings/gui/dialog-funcs.scrbl @@ -221,7 +221,8 @@ The class that implements the dialog provides a @scheme[get-message] @scheme[get-top-level-windows] function.) The @racket[message-box] function can be called int a thread other - than the current eventspace's handler thread, in which case the + than the handler thread of the relevant eventspace (i.e., the eventspace of + @racket[parent], or the current eventspace if @racket[parent] is @racket[#f]), in which case the current thread blocks while the dialog runs on the handler thread.} @defproc[(message-box/custom [title label-string?] @@ -305,7 +306,8 @@ The class that implements the dialog provides a @scheme[get-message] @scheme[get-top-level-windows] function.) The @racket[message-box/custom] function can be called int a thread - other than the current eventspace's handler thread, in which case the + other than the handler thread of the relevant eventspace (i.e., the eventspace of + @racket[parent], or the current eventspace if @racket[parent] is @racket[#f]), in which case the current thread blocks while the dialog runs on the handler thread.} @defproc[(message+check-box [title label-string?]