for modal, just change the example:
ex = New Window( "Dialog() example",
<<Modal,
<<Return Result,
V List Box( H List Box( "Set this value", variable = text Edit Box( "Change this text" ) ), H List Box( Button Box( "OK" ), Button Box( "Cancel" ) ) )
);
// because the window is modal, the window must be closed before the following code runs
If(
ex["button"] == 1, // not canceled
// then show the value
write(ex["variable"] ), // note: variable is the name of the variable holding the text edit box
// else report no selection
write("CANCEL"); // cancel button or red X was pressed
);
The example in the scripting index needs a small rewrite to be more useful. I've fixed the main problem and added comments above. The main problem is the if-clause in the example is a confusing double-statement with a semicolon.
edit: repair formatting (for some reason, the code formatter wants to mess up the final else statement)
Craige