Subscribe Bookmark RSS Feed

Combining Number Edit Boxes

mwechtal

Community Trekker

Joined:

Jan 19, 2012

I am using Number Edit Boxes to get user input in a JMP 13 script, like this:

New Window( "A", Modal, neb1 = Number Edit Box( 1 ) );
A = neb1 << get;

New Window( "B", Modal, neb2 = Number Edit Box( 2 ) );
B = neb2 << get;

New Window( "C", modal, neb3 = Number Edit Box( 3 ));
C = neb3 << get;

I would like to combine them into a single box with one "OK" button. The manuals don't seem to cover this, or I don't understand. Can anyone help?

 

Thanks.

2 ACCEPTED SOLUTIONS

Accepted Solutions
pmroz

Super User

Joined:

Jun 23, 2011

Solution

Combine them into one New Window call:

New Window( "Get Numbers", << modal(),
	hlistbox(
		textbox("Enter value for A: "),
		neb1 = Number Edit Box( 1 ),
	),
	hlistbox(
		textbox("Enter value for B: "),
		neb2 = Number Edit Box( 2 ),
	),
	hlistbox(
		textbox("Enter value for C: "),
		neb3 = Number Edit Box( 3 ),
	),
	ok_btn = button box("OK",
		A = neb1 << get;
		B = neb2 << get;
		C = neb3 << get;
	),
);
print(a, b, c);
David_Burnham

Super User

Joined:

Jul 13, 2011

Solution

NumberEditBox is an example of a display box.  You can put multiple display boxes in a window by separating them with a comma.  

New Window("ABC", <<Modal,
	neb1 = Number Edit Box( 1 ),
	neb2 = Number Edit Box( 1 ),
	neb3 = Number Edit Box( 1 ),
);
A = neb1 << get;
B = neb2 << get;
C = neb3 << get;

For further composition you can use display boxes that control layout: V List Box, H List Box, Lineup Box:

nw = New Window("ABC", <<Modal,
	Lineup Box(NCol(2),
		Text Box("A: "), neb1 = Number Edit Box( 1 ),
		Text Box("B: "), neb2 = Number Edit Box( 1 ),
		Text Box("C: "), neb3 = Number Edit Box( 1 ),
	)
);
If (nw["Button"]==-1,
	Throw() // user cancelled
);
A = neb1 << get;
B = neb2 << get;
C = neb3 << get;
show(A,B,C);

 

-Dave
5 REPLIES
pmroz

Super User

Joined:

Jun 23, 2011

Solution

Combine them into one New Window call:

New Window( "Get Numbers", << modal(),
	hlistbox(
		textbox("Enter value for A: "),
		neb1 = Number Edit Box( 1 ),
	),
	hlistbox(
		textbox("Enter value for B: "),
		neb2 = Number Edit Box( 2 ),
	),
	hlistbox(
		textbox("Enter value for C: "),
		neb3 = Number Edit Box( 3 ),
	),
	ok_btn = button box("OK",
		A = neb1 << get;
		B = neb2 << get;
		C = neb3 << get;
	),
);
print(a, b, c);
David_Burnham

Super User

Joined:

Jul 13, 2011

Solution

NumberEditBox is an example of a display box.  You can put multiple display boxes in a window by separating them with a comma.  

New Window("ABC", <<Modal,
	neb1 = Number Edit Box( 1 ),
	neb2 = Number Edit Box( 1 ),
	neb3 = Number Edit Box( 1 ),
);
A = neb1 << get;
B = neb2 << get;
C = neb3 << get;

For further composition you can use display boxes that control layout: V List Box, H List Box, Lineup Box:

nw = New Window("ABC", <<Modal,
	Lineup Box(NCol(2),
		Text Box("A: "), neb1 = Number Edit Box( 1 ),
		Text Box("B: "), neb2 = Number Edit Box( 1 ),
		Text Box("C: "), neb3 = Number Edit Box( 1 ),
	)
);
If (nw["Button"]==-1,
	Throw() // user cancelled
);
A = neb1 << get;
B = neb2 << get;
C = neb3 << get;
show(A,B,C);

 

-Dave
mwechtal

Community Trekker

Joined:

Jan 19, 2012

And I quickly get 2 usable answers! I love the JMP community!

 

Other than the included Scripting Guide, or Jump into JMP Scripting is there a manual that covers scripts? Hopefully with lots of examples?

Jeff_Perkinson

Community Manager

Joined:

Jun 23, 2011

Another book to recommend is JSL Companion: Common Applications of the JMP Scripting Language. It is, just as you asked, full of examples of real world tasks.

-Jeff
David_Burnham

Super User

Joined:

Jul 13, 2011

Here is a detailed example scenario that you can work through:

take-this-jsl-challenge

(links to an external website: a blog I maintain for JMP/JSL discussions)

 

-Dave