A new eventspace is created with the wx:make-eventspace procedure. The return value is an first-class eventspace value. The predicate procedure wx:eventspace? returns #t when applied to eventspace values.
Whenever a frame, dialog, or timer is created, it is associated with the eventspace specified by the wx:current-eventspace parameter (see MzScheme Reference Manual for information about parameterizations). When the wx:current-eventspace procedure is called with no arguments, it returns the current eventspace value. When wx:current-eventspace is called with an eventspace value, it changes the current eventspace to the one that is provided.
In the example below, a new eventspace is created and a new editor frame is created in the new eventspace (the parameterize syntactic form temporary sets a parameter value).
(let ([new-es (wx:make-eventspace)]) (parameterize ([wx:current-eventspace new-es]) (make-object mred:editor-frame%)))
When an eventspace is created, it is placed under the management of the current custodian (see MzScheme Reference Manual for information about parameterizations). When a custodian shuts down an eventspace, all frames and dialogs associated with the eventspace are destroyed (without calling on-close in wx:frame% or on-close in wx:dialog-box%) and all timers in the eventspace are stopped.