For the latest version of JMP Help, visit JMP.com/help.


Scripting Guide > Display Trees > Convert Deprecated Dialog to New Window > Differences Between New Window and the Deprecated Dialog
Publication date: 04/21/2023

Differences Between New Window and the Deprecated Dialog

This section shows the differences between display boxes in theNew Window() and deprecated Dialog() scripts. Table 11.4 summarizes those differences. More information can be found in the sections that follow the table.

Table 11.4 Display Boxes in New Window and Deprecated Dialog Scripts

Box Type

New Window

Deprecated Dialog

Strings and Lists

win = New Window( "Combo Box",

<<Modal,

<<ReturnResult,

cb = Combo Box( {"True", "False"} ),

);

Dialog( Title( "Combo Box" ),

cb = Combo Box( "True", "False" ),

);

List Boxes and Check Boxes

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 )

),

);

Line Up Items

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)}

Radio Boxes

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"} ),

);

Text Edit Boxes

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" ), )

);

Number Edit Boxes

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 ),

...);

Strings and Lists

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

);

Note: The script does not explicitly define the OK button. For modal windows, JMP automatically adds the OK button. Explicitly define each additional button.

Additionally, the deprecated Dialog() could include " " to indicate empty text. New Window() requires that empty text appear in a Text Box (" ").

List Boxes and Check Boxes

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.

Note: Boxes are vertically aligned by default if H List Box() or V List Box() are omitted.

The following example creates a window with three horizontal check boxes and an OK button:

win = New Window( "H List Box",
	<<Modal,
	<<Return Result,
	H List Box(
		kb1 = Check Box( "a" ),
		kb2 = Check Box( "b" ),
		kb3 = Check Box( "c" )
	),
);

Here is the same window created with the deprecated Dialog() and an H List():

dlg = Dialog( Title( "H List" ),
	H List(
			kb1 = Check Box( "a", 0 ),
			kb2 = Check Box( "b", 0 ),
			kb3 = Check Box( "c", 0 )
    ),
);

Line Up Items

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.

The following example arranges the text boxes in one column and the number edit boxes in another column:

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.

Figure 11.39 Default Dialog Arrangements for Windows (left) and macOS (right) 

Default Dialog Arrangements for Windows (left) and macOS (right)

Here’s the same window created with the deprecated Dialog() and Line Up:

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.

Radio Boxes

Another difference between New Window() and the deprecated Dialog() is the usage of Radio Box.

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"} )
	)
);

In the deprecated Dialog(), the Radio Buttons() automatically appear in a panel box.

dlg = Dialog( Title( "Radio Buttons" ),
	rb = Radio Buttons( {"a", "b", "c"} ),
);

Text Edit Boxes

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" ) 	) );

Here is the same window created with the deprecated Dialog() and Edit Text():

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, New Window() assigns only two elements to the list (the specified list items and the button).

Number Edit Boxes

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 )
	),
);

Here is the same window created with the deprecated Dialog() and Edit Number():

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.

Want more information? Have questions? Get answers in the JMP User Community (community.jmp.com).