This section shows the differences between display boxes in New Window() and the deprecated Dialog() scripts. Table 11.4 summarizes those differences. Details are in the sections that follow the table.
win = New Window( "Combo Box", <<Modal, <<ReturnResult, cb = Combo Box( {"True", "False"} ), ); |
Dialog( Title( "Combo Box" ), cb = Combo Box( "True", "False" ), ); |
|
win = New Window( "H List Box", <<Modal, <<ReturnResult, H List Box( kb1 = Check Box( "a" ), kb2 = Check Box( "b" ), kb3 = Check Box( "c" ) ), ); |
dlg = Dialog( Title( "H List" ), H List( kb1 = Check Box( "a", 0 ), kb2 = Check Box( "b", 0 ), kb3 = Check Box( "c", 0 ) ), ); |
|
win = New Window( "Line Up Box", <<Modal, <<ReturnResult, V List Box( Line Up Box(NCol(2), Text Box("Set this value"), var1=Number Edit Box(42), Text Box("Set another value"), var2=Number Edit Box(86), ), ), H List Box( Button Box( "OK" ), Button Box( "Cancel" ) ) ); // returns: {Button( 1 )}
|
dlg = Dialog( V List( Line Up(2, "Set this value", variable=Edit Number(42), "Set another value", var2=Edit Number(86)), H List(Button("OK"), Button("Cancel")))); // returns: {variable = 42, var2 = 86, Button(1)}
|
|
win = New Window( "Radio Box", <<Modal, <<ReturnResult, Panel Box( "Select", rbox = Radio Box( {"a", "b", "c"} ) ) ); |
dlg = Dialog( Title("Radio Buttons"), rb = Radio Buttons( {"a", "b", "c"} ), ); |
|
win = New Window( "Text Edit Box", <<Modal, <<ReturnResult, V List Box( Text Box( "Strings" ), str1 = Text Edit Box( "The" ), str2 = Text Edit Box( "quick" ), ) ); |
dlg = Dialog( Title( "Edit Text" ), V List( "Strings", str1 = Edit Text( "The" ), str2 = Edit Text( "quick" ), ) ); |
|
win = New Window( "Number Edit Box", <<Modal, <<ReturnResult, V List Box( Text Box("Random Numbers"), num1 = Number Edit Box( Random Uniform()), num2 = Number Edit Box( Random Uniform() * 10), ...); |
dlg = Dialog( Title( "Edit Number" ), V List( "Random Numbers", num1 = Edit Number( Random Uniform() ), num2 = Edit Number( Random Uniform() * 10 ), ...); |
A major difference between the New Window() and the deprecated Dialog() functions is how you specify lists and strings as arguments. In New Window(), the items must be placed in a list. In the deprecated Dialog(), items are generally separated by commas. For example, compare the following two instances of a combo box.
win = New Window( "Combo Box",// modal New Window
<<Modal,
<<Return Result,
cb = Combo Box( {"True", "False"} ), // items are in a bracketed list
);
Dialog( Title( "Combo Box" ),// modal Dialog
cb = Combo Box( "True", "False" ), // items are separated by commas
);
Additionally, the deprecated Dialog() could include " " to indicate empty text. New Window() requires that empty text appear in a Text Box (" ").
In New Window(), boxes are horizontally aligned with H List Box() and vertically aligned with V List Box(). In the deprecated Dialog(), you use H List and V List instead.
win = New Window( "H List Box",
<<Modal,
<<Return Result,
H List Box(
kb1 = Check Box( "a" ),
kb2 = Check Box( "b" ),
kb3 = Check Box( "c" )
),
);
dlg = Dialog( Title( "H List" ),
H List(
kb1 = Check Box( "a", 0 ),
kb2 = Check Box( "b", 0 ),
kb3 = Check Box( "c", 0 )
),
);
In New Window(), use Line Up Box() to arrange items in the number of columns that you specify. In the deprecated Dialog(), you used Line Up.
win = New Window( "Line Up Box",
<<Modal,
<<Return Result,
V List Box(
Lineup Box( N Col( 2 ),
Text Box( "Set this value" ),
var1 = Number Edit Box( 42 ),
Text Box( "Set another value" ),
var2 = Number Edit Box( 86 ),
),
),
H List Box( Button Box( "OK" ), Button Box( "Cancel" ) ) )
);
Clicking OK returns the following result in the log window:
List( 3 elements ) assigned.
dlg = Dialog(
V List(
Line Up( 2,
"Set this value", variable = Edit Number( 42 ),
"Set another value", var2 = Edit Number( 86 )
),
H List( Button( "OK" ), Button( "Cancel" ) )
)
);
Clicking OK returns the following result in the log window:
{variable = 42, var2 = 86, Button(1)}
Note: JMP does exert some control over OK and Cancel button positions to ensure that dialog boxes are consistent with what the operating system expects. In certain cases, JMP needs to override your H List Box(), V List Box(), and Line Up Box() settings for Button( "OK" ) and Button( "Cancel" ). Do not be alarmed if the result is slightly different from what you expect.
In New Window(), you must define the Panel Box() container for Radio Box() if you want the radio buttons in a box.
win = New Window( "Radio Box",
<<Modal,
<<Return Result,
Panel Box( "Select",
rbox = Radio Box( {"a", "b", "c"} )
)
);
dlg = Dialog( Title( "Radio Buttons" ),
rb = Radio Buttons( {"a", "b", "c"} ),
);
In New Window(), use Text Edit Box() to create editable boxes that contain specified strings. In the deprecated Dialog(), you used Edit Text().
win = New Window( "Text Edit Box",
<<Modal,
<<Return Result,
V List Box(
Text Box( "Strings" ),
str1 = Text Edit Box( "The" ),
str2 = Text Edit Box( "quick" ),
str3 = Text Edit Box( "brown" ),
str4 = Text Edit Box( "fox" ),
str5 = Text Edit Box( "jumps" ),
str6 = Text Edit Box( "over" ),
str7 = Text Edit Box( "the" ),
str8 = Text Edit Box( "lazy" ),
str9 = Text Edit Box( "dog" ) ) );
dlg = Dialog(
Title( "Edit Text" ),
V List(
"Strings",
str1 = Edit Text( "The" ),
str2 = Edit Text( "quick" ),
str3 = Edit Text( "brown" ),
str4 = Edit Text( "fox" ),
str5 = Edit Text( "jumps" ),
str6 = Edit Text( "over" ),
str7 = Edit Text( "the" ),
str8 = Edit Text( "lazy" ),
str9 = Edit Text( "dog" )
)
);
Alternatively, use String Col Edit Box() to create editable boxes within in a table structure that contains specified strings. For example, the following script creates a window named “String Col Edit Box”. The window contains a column (labeled “Strings”) of editable boxes, each of which contains the specified string:
win = New Window( "String Col Edit Box",
<<Modal,
<<Return Result,
steb = String Col Edit Box(
"Strings",
{"The", "quick", "brown", "fox", "jumps", "over", "the", "lazy", "dog"}
)
);
Note: In the preceding example, the String Col Edit Box() assigns only two elements to the list ("Strings" and the specified list items). The New Window() and deprecated Dialog() examples for Text Edit Box() assign 10 elements to the list.
In New Window(), use Number Edit Box() to create editable boxes that contains the specified numbers. In the deprecated Dialog(), you used Edit Number().
win = New Window( "Number Edit Box",
<<Modal,
<<ReturnResult,
V List Box(
Text Box( "Random Numbers" ),
num1 = Number Edit Box( Random Uniform() ),
num2 = Number Edit Box( Random Uniform() * 10 ),
num3 = Number Edit Box( Random Uniform() * 100 ),
num4 = Number Edit Box( Random Uniform() * 1000 )
),
);
dlg = Dialog(
Title( "Edit Number" ),
V List(
"Random Numbers",
num1 = Edit Number( Random Uniform() ),
num2 = Edit Number( Random Uniform() * 10 ),
num3 = Edit Number( Random Uniform() * 100 ),
num4 = Edit Number( Random Uniform() * 1000 )
),
);
Another method for creating the same window uses Number Col Edit Box() to create editable boxes within in a table structure that contains specified numbers. For example, the following script creates a window named “Number Col Edit Box”. The window contains a column (labeled “Random Numbers”) of editable boxes, each of which shows the specified type of random number:
win = New Window( "Number Col Edit Box",
<<Modal,
<<ReturnResult,
nceb = Number Col Edit Box(
"Random Numbers",
{num1 = Random Uniform(), num2 = Random Uniform() * 10, num3 =
Random Uniform() * 100, num4 = Random Uniform() * 1000}
),
);
Note: In the preceding example, the Number Col Edit Box() assigns only two elements to the list. The New Window() and deprecated Dialog() examples for Number Col Edit Box() assign five elements to the list.