Hi Clint,
> Now, my question: Is it possible to achieve behavior like the
> Javascript's alert() function with Pivot? That is, I'd like to put up a
> simple yes/no "do something"/"please don't" popup on the screen, and
> have the app block - the alert doesn't just block input to other
> elements - until the user chooses an option, or closes the popup. This
> is possible in SWT, I don't know about Swing.
Sorry, it is not possible - as you noted, Window#open() is not a blocking call
in WTK. Pivot is ultimately based on AWT, which uses a push model for event
notifications (vs. pull). If you were to call a blocking method from a user
input event such as a button press, no further event processing could occur
until that method had returned, and the entire UI would appear to freeze.
I personally don't mind the anonymous inner class syntax:
dialog.open(owner, new DialogCloseListener() {
@Override
public void dialogClosed(Dialog dialog, boolean modal) {
// Get selected option and act on it
}
});
I actually think this reflects a pretty consistent design - you open the dialog
in response to one event (e.g. "button pressed"), and you handle the dialog's
result in response to another event (e.g. "dialog closed").
> Making the call to Dialog.open() from another thread doesn't have any effect.
Note that, as in Swing, multi-threaded access to UI elements is not supported.
All UI operations must be performed on the EDT.
Hope this helps,
Greg