PackageDescription: ForkedUIEvents


Forked UI Events

Last published: June 24, 2002 by 'reinz'

Defines 1 Classes
Extends 2 Classes


This provides an alternative approach to the ForkedUI stuff provided by an old ParcPlace tech note. The idea is that you can execute blocks requiring ui activity on the UI thread, and cause the calling thread to wait for the result. The example below does something like this, wherein four threads in parallel ask the user four times to make a choice. It should allow multiple dialogs from different threads to be open in serial fashion, but never allow the calling thread to have two of its iterations open at a given time.

rand := Random new.
1 to: 4 do: [:n |
[1 to: 4 do: [:i | | result |
(Delay forSeconds: rand next * 10) wait.
result := [Dialog choose: ('thread: <1p> iteration: <2p>' expandMacrosWith: n with: i) labels: #('a' 'b' 'c' 'd') values: #('a' 'b' 'c' 'd') default: nil ] uiEvent.
('<1p> <2p> <3s>' expandMacrosWith: n with: i with: result) out.
]
] fork
]