The following two examples produce identical windows using the preferred New Window() with the Modal argument and the deprecated Dialog() function. New Window() provides more display options and better control over the content and functions of the window.
win = New Window( "New Window Example",
<<Modal,
<<ReturnResult, // ensures that you get the same result as with Dialog
V List Box(
V List Box(
Text Box( "Radio Frequency Embolism Projection" ),
Line Up Box(
NCol( 2 ),
Text Box( "Lower Spec Limit" ),
lsl_box = Number Edit Box( 230 ),
Text Box( "Upper Spec Limit" ),
usl_box = Number Edit Box( 340 ),
Text Box( "Threshold" ),
threshold_box = Number Edit Box( 275 )
),
H List Box(
Panel Box( "Type of Radio",
rb_box1 = Radio Box( {"RCA", "Matsushita",
"Zenith", "Sony"} )),
Panel Box( "Type of Antenna" ,
rb_box2 = Radio Box( {"Dish", "Helical", "Polarizing",
"Radiant Array"} ) )
),
cb_box1 = Check Box( "Emission Synchronization" ),
Text Box( "Title for plot" ),
title_box = Text Edit Box( "My projection" ),
H List Box( Text Box( "Quality" ),
cb_box2 = Combo Box( {"Fealty", "Loyalty", "Piety", "Obsequiousness"} ) )
),
H List Box(
Align( Right ),
Spacer Box(),
Button Box( "OK",
lsl = lsl_box << Get;
usl = usl_box << Get;
threshold = threshold_box << Get;
radio_type = rb_box1 << Get;
antenna = rb_box2 << Get;
synch = cb_box1 << Get;
title = title_box << Get Text;
quality = cb_box2 << Get;
),
Button Box( "Cancel" )
)
)
);
If(win["Button"] == 1,
// if the user clicks OK, show the selections in the log
Show( "OK", lsl, usl, threshold, radio_type, antenna, synch, title, quality);
,
Show( "Canceled" ); // if the user clicked Cancel, print "Canceled"
);
dlg = Dialog(
Title( "Dialog Example" ),
H List(
V List(
"Radio Frequency Embolism Projection",
Lineup( 2,
"Lower Spec Limit", lsl = Edit Number( 230 ),
"Upper Spec Limit", usl = Edit Number( 340 ),
"Threshold", threshold = Edit Number( 275 )
),
H List(
V List(
"Type of Radio",
type = Radio Buttons( "RCA", "Matsushita", "Zenith", "Sony" )
),
V List(
"Type of Antenna",
antenna = Radio Buttons( "Dish", "Helical", "Polarizing",
"Radiant Array" )
)
),
synch = Check Box( "Emission Synchronization", 0 ),
"Title for plot",
title = Edit Text( "My projection" ),
H List(
"Quality",
quality = Combo Box( "Fealty", "Loyalty", "Piety", "Obsequiousness"
)
)
),
V List( Button( "OK" ), Button( "Cancel" ) )
)
);
If( dlg["Button"] == 1,
Show(
"OK",
dlg["lsl"],
dlg["usl"],
dlg["threshold"],
dlg["type"],
dlg["antenna"],
dlg["synch"],
dlg["title"],
dlg["quality"]
),
Show( "Canceled" )
);
Note: Use Return Result to get the same result in New Window() as with the deprecated Dialog(). See Construct a Modal Window for an example.