cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Try the Materials Informatics Toolkit, which is designed to easily handle SMILES data. This and other helpful add-ins are available in the JMP® Marketplace
Choose Language Hide Translation Bar
mwechtal
Level III

Combining Number Edit Boxes

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

Re: Combining Number Edit Boxes

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

View solution in original post

David_Burnham
Super User (Alumni)

Re: Combining Number Edit Boxes

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

View solution in original post

5 REPLIES 5
pmroz
Super User

Re: Combining Number Edit Boxes

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 (Alumni)

Re: Combining Number Edit Boxes

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
Level III

Re: Combining Number Edit Boxes

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 Community Manager

Re: Combining Number Edit Boxes

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 (Alumni)

Re: Combining Number Edit Boxes

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