fix `message-box' to use eventspace of parent, if any

This commit is contained in:
Matthew Flatt 2011-01-20 15:46:03 -07:00
parent caa0026bc2
commit 128fedaceb
2 changed files with 13 additions and 7 deletions

View File

@ -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

View File

@ -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?]