cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Register to attend Discovery Summit 2025 Online: Early Users Edition, Sept. 24-25.
  • New JMP features coming to desktops everywhere this September. Sign up to learn more at jmp.com/launch.
Choose Language Hide Translation Bar

Get a New Window with exsisting radiobuttons

Hello JMP Community,

I am new to JMP. I have a doubt. So below attached is my code, When I select combo box button and select a shape and click ok then a new window should pop up by only highlighting required columns. for example, if I select L-shape from ShapeChoice, the new window should pop up with all the given HL,VL,HH, VH, BL,UL, etc.. but only give the option to input the values only for HL,HW,HH,VL,VW,and VH.Can you please help me out. Thank you in advance.

Names Default To Here( 1 );
dlg = New Window("Dimensions",
	<<Modal,
	<<Return Result,
	V list Box(
		Text Box(" "),
		Text Box("Please select the units information: " ),
		ComboChoice = RadioBox({"Ft","m"}),
		ShapeChoice = Combobox({"Rectangle/Square", "L-Shape", "U-Shape", "Oval"}),
		Text Box(""),
	),
	V list box(
		Text Box("Please enter the following information: " ),
		Text Box("Horizontal Length"),hl_box = Number Edit Box(0),
		Text box("Horizontal Width"), hw_box = Number Edit Box(0),
		Text Box("Horizontal Height"), hh_box = Number Edit Box(0),
		Text box("Vertical Length"),vl_box = Number Edit Box(0),
		Text Box("Vertical Width"), vw_box = Number Edit Box(0),
		Text Box("Vertical Height"),vh_box = Number Edit Box(0),
		Text box("Bottom Length"),bl_box = Number Edit box(0),
		Text Box("Bottom Width"), bw_box = Number Edit Box(0),
		Text Box("Bottom Height"), bh_box = Number Edit Box(0),
		Text box("upper Length"),ul_box = Number Edit box(0),
		Text Box("upper Width"), uw_box = Number Edit Box(0),
		Text Box("upper Height"), uh_box = Number Edit Box(0),
	),
	H List Box(
		Button Box("Ok",
			ShapeChoice = ShapeChoice << Get;
			ComboChoice = ComboChoice << Get;
			hl = hl_box << Get;
			hw = hw_box << Get;
			hh = hh_box << Get;
			vl = vl_box << Get;
			vw = vw_box << Get;
			vh = vh_box << Get;
			bl = bl_box << Get;
			bw = bw_box << Get;
			bh = bh_box << Get;
			ul = ul_box << Get;
			uw = uw_box << Get;
			uh = uh_box << Get;	
		),
		Button Box("Cancel"),
	),
);
1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: Get a New Window with exsisting radiobuttons

Here is the approach I would take

Names Default To Here( 1 );


hideAll = Function( {},
	tb1 << visibility("collapse");
	tb2 << visibility("collapse");
	tb3 << visibility("collapse");
	tb4 << visibility("collapse");
	tb5 << visibility("collapse");
	tb6 << visibility("collapse");
	tb7 << visibility("collapse");
	tb8 << visibility("collapse");
	tb9 << visibility("collapse");
	tb10 << visibility("collapse");
	tb11 << visibility("collapse");
	tb12 << visibility("collapse");
	hl_box << visibility("collapse");
	hw_box << visibility("collapse");
	hh_box << visibility("collapse");
	vl_box << visibility("collapse");
	vw_box << visibility("collapse");
	vh_box << visibility("collapse");
	bl_box << visibility("collapse");
	bw_box << visibility("collapse");
	bh_box << visibility("collapse");
	ul_box << visibility("collapse");
	uw_box << visibility("collapse");
	uh_box << visibility("collapse");
	comboVal = (ShapeChoice << get items)[ShapeChoice << get];
	If( comboVal == "Rectangle/Square",
		tb1 << visibility("Visible");
		hl_box << visibility("Visible");
		tb4 << visibility("Visible");
		vl_box << visibility("Visible");
	,
		comboVal == "L-Shape",
		tb1 << visibility("Visible");
		hl_box << visibility("Visible");
		tb2 << visibility("Visible");
		hw_box << visibility("Visible");
		tb3 << visibility("Visible");
		hh_box << visibility("Visible");
		tb4 << visibility("Visible");
		vl_box << visibility("Visible");
		tb5 << visibility("Visible");
		vw_box << visibility("Visible");
		tb6 << visibility("Visible");
		vh_box << visibility("Visible");
	)
);

// This Expr is where all of the script is placed that is to be run after the user
// clicks on OK in the Dimensions data entry window
runtherest = Expr( 

);


dlg = New Window("Dimensions",
	//<<Modal,
	<<Return Result,
	V list Box(
		Text Box(" "),
		Text Box("Please select the units information: " ),
		ComboChoice = RadioBox({"Ft","m"}),
		ShapeChoice = Combobox({"Rectangle/Square", "L-Shape", "U-Shape", "Oval"}, hideAll),
		Text Box(""),
	),
	V list box(
		Text Box("Please enter the following information: " ),
		tb1 = Text Box("Horizontal Length"),hl_box = Number Edit Box(0),
		tb2 = Text box("Horizontal Width"), hw_box = Number Edit Box(0),
		tb3 = Text Box("Horizontal Height"), hh_box = Number Edit Box(0),
		tb4 = Text box("Vertical Length"),vl_box = Number Edit Box(0),
		tb5 = Text Box("Vertical Width"), vw_box = Number Edit Box(0),
		tb6 = Text Box("Vertical Height"),vh_box = Number Edit Box(0),
		tb7 = Text box("Bottom Length"),bl_box = Number Edit box(0),
		tb8 = Text Box("Bottom Width"), bw_box = Number Edit Box(0),
		tb9 = Text Box("Bottom Height"), bh_box = Number Edit Box(0),
		tb10 = Text box("upper Length"),ul_box = Number Edit box(0),
		tb11 = Text Box("upper Width"), uw_box = Number Edit Box(0),
		tb12 = Text Box("upper Height"), uh_box = Number Edit Box(0),
	),
	H List Box(
		Button Box("Ok",
			ShapeChoice = comboVal;
			ComboChoice = (comboChoice << get items)[comboChoice << get];
			hl = hl_box << Get;
			hw = hw_box << Get;
			hh = hh_box << Get;
			vl = vl_box << Get;
			vw = vw_box << Get;
			vh = vh_box << Get;
			bl = bl_box << Get;
			bw = bw_box << Get;
			bh = bh_box << Get;
			ul = ul_box << Get;
			uw = uw_box << Get;
			uh = uh_box << Get;	
			dlg << close window;
			runtherest;
		),
		Button Box("Cancel",
			dlg << close window;
			Throw();
		),
	),
);
hideAll;
Jim

View solution in original post

8 REPLIES 8
jthi
Super User

Re: Get a New Window with exsisting radiobuttons

You might want to take a look at IfBox. This recent post might also give some ideas How to hide\unhide GUI elements effectively? 

-Jarmo

Re: Get a New Window with exsisting radiobuttons

Thank you for help but I also need a user input option to it.

jthi
Super User

Re: Get a New Window with exsisting radiobuttons

So you could use If Boxes which you set to 0/1 based on user selection?

-Jarmo

Re: Get a New Window with exsisting radiobuttons

Didn't understand. I'm sorry but I am new to this. So can you explain me Thank you!

jthi
Super User

Re: Get a New Window with exsisting radiobuttons

I have to first better understand what you want to have. When user selects the shape, which number edit boxes should appear?

-Jarmo
txnelson
Super User

Re: Get a New Window with exsisting radiobuttons

Here is the approach I would take

Names Default To Here( 1 );


hideAll = Function( {},
	tb1 << visibility("collapse");
	tb2 << visibility("collapse");
	tb3 << visibility("collapse");
	tb4 << visibility("collapse");
	tb5 << visibility("collapse");
	tb6 << visibility("collapse");
	tb7 << visibility("collapse");
	tb8 << visibility("collapse");
	tb9 << visibility("collapse");
	tb10 << visibility("collapse");
	tb11 << visibility("collapse");
	tb12 << visibility("collapse");
	hl_box << visibility("collapse");
	hw_box << visibility("collapse");
	hh_box << visibility("collapse");
	vl_box << visibility("collapse");
	vw_box << visibility("collapse");
	vh_box << visibility("collapse");
	bl_box << visibility("collapse");
	bw_box << visibility("collapse");
	bh_box << visibility("collapse");
	ul_box << visibility("collapse");
	uw_box << visibility("collapse");
	uh_box << visibility("collapse");
	comboVal = (ShapeChoice << get items)[ShapeChoice << get];
	If( comboVal == "Rectangle/Square",
		tb1 << visibility("Visible");
		hl_box << visibility("Visible");
		tb4 << visibility("Visible");
		vl_box << visibility("Visible");
	,
		comboVal == "L-Shape",
		tb1 << visibility("Visible");
		hl_box << visibility("Visible");
		tb2 << visibility("Visible");
		hw_box << visibility("Visible");
		tb3 << visibility("Visible");
		hh_box << visibility("Visible");
		tb4 << visibility("Visible");
		vl_box << visibility("Visible");
		tb5 << visibility("Visible");
		vw_box << visibility("Visible");
		tb6 << visibility("Visible");
		vh_box << visibility("Visible");
	)
);

// This Expr is where all of the script is placed that is to be run after the user
// clicks on OK in the Dimensions data entry window
runtherest = Expr( 

);


dlg = New Window("Dimensions",
	//<<Modal,
	<<Return Result,
	V list Box(
		Text Box(" "),
		Text Box("Please select the units information: " ),
		ComboChoice = RadioBox({"Ft","m"}),
		ShapeChoice = Combobox({"Rectangle/Square", "L-Shape", "U-Shape", "Oval"}, hideAll),
		Text Box(""),
	),
	V list box(
		Text Box("Please enter the following information: " ),
		tb1 = Text Box("Horizontal Length"),hl_box = Number Edit Box(0),
		tb2 = Text box("Horizontal Width"), hw_box = Number Edit Box(0),
		tb3 = Text Box("Horizontal Height"), hh_box = Number Edit Box(0),
		tb4 = Text box("Vertical Length"),vl_box = Number Edit Box(0),
		tb5 = Text Box("Vertical Width"), vw_box = Number Edit Box(0),
		tb6 = Text Box("Vertical Height"),vh_box = Number Edit Box(0),
		tb7 = Text box("Bottom Length"),bl_box = Number Edit box(0),
		tb8 = Text Box("Bottom Width"), bw_box = Number Edit Box(0),
		tb9 = Text Box("Bottom Height"), bh_box = Number Edit Box(0),
		tb10 = Text box("upper Length"),ul_box = Number Edit box(0),
		tb11 = Text Box("upper Width"), uw_box = Number Edit Box(0),
		tb12 = Text Box("upper Height"), uh_box = Number Edit Box(0),
	),
	H List Box(
		Button Box("Ok",
			ShapeChoice = comboVal;
			ComboChoice = (comboChoice << get items)[comboChoice << get];
			hl = hl_box << Get;
			hw = hw_box << Get;
			hh = hh_box << Get;
			vl = vl_box << Get;
			vw = vw_box << Get;
			vh = vh_box << Get;
			bl = bl_box << Get;
			bw = bw_box << Get;
			bh = bh_box << Get;
			ul = ul_box << Get;
			uw = uw_box << Get;
			uh = uh_box << Get;	
			dlg << close window;
			runtherest;
		),
		Button Box("Cancel",
			dlg << close window;
			Throw();
		),
	),
);
hideAll;
Jim
chris_dennis
Level III

Re: Get a New Window with exsisting radiobuttons

Solution script is very helpful.  I am also working in user information collection problem now.  One of the items I am trying to collect is a lot list based on a JMP data table.  I am sure there is a better way to do this, but I added a new section to the solution script that lets the user pick a directory, file, and column containing the information.  Any advice to make this better?  Also, I have not seen the runtherest = Expr(); method.  I tried to type some simple script actions into the space between paratheses, but I could not get it to execute.  What am I missing?

 
Names Default To Here( 1 );


hideAll = Function( {},
	tb1 << visibility("collapse");
	tb2 << visibility("collapse");
	tb3 << visibility("collapse");
	tb4 << visibility("collapse");
	tb5 << visibility("collapse");
	tb6 << visibility("collapse");
	tb7 << visibility("collapse");
	tb8 << visibility("collapse");
	tb9 << visibility("collapse");
	tb10 << visibility("collapse");
	tb11 << visibility("collapse");
	tb12 << visibility("collapse");
	hl_box << visibility("collapse");
	hw_box << visibility("collapse");
	hh_box << visibility("collapse");
	vl_box << visibility("collapse");
	vw_box << visibility("collapse");
	vh_box << visibility("collapse");
	bl_box << visibility("collapse");
	bw_box << visibility("collapse");
	bh_box << visibility("collapse");
	ul_box << visibility("collapse");
	uw_box << visibility("collapse");
	uh_box << visibility("collapse");
	comboVal = (ShapeChoice << get items)[ShapeChoice << get];
	If( comboVal == "Rectangle/Square",
		tb1 << visibility("Visible");
		hl_box << visibility("Visible");
		tb4 << visibility("Visible");
		vl_box << visibility("Visible");
	,
		comboVal == "L-Shape",
		tb1 << visibility("Visible");
		hl_box << visibility("Visible");
		tb2 << visibility("Visible");
		hw_box << visibility("Visible");
		tb3 << visibility("Visible");
		hh_box << visibility("Visible");
		tb4 << visibility("Visible");
		vl_box << visibility("Visible");
		tb5 << visibility("Visible");
		vw_box << visibility("Visible");
		tb6 << visibility("Visible");
		vh_box << visibility("Visible");
	,
		comboVal == "Lot List Input (from a JMP File)",
		tb13 << visibility("Visible");
		dir=Pick Directory(1);
		files = Files In Directory(dir);
//	It would be nice if display could be updated to show collected information before user makes selection.
		win2=New Window ("Select File Containing Lot List",
			<<Modal,
			<<Return Result,
			rb2= Radio Box(
				files,
				show(rb2 << Get() ),
				dt=open(dir||files[rb2 << Get()])
			)
		);	
		c=dt << Get Column Names( );
		win3=New Window ("Select column Containing Lot List",
			<<Modal,
			<<Return Result,
			rb3= Radio Box(
				c,
				show(rb3 << Get() )
			)
		);
		ltv = eval( win3[1] );
		ltcn = Eval Expr( c[ltv] );
	)
);

// This Expr is where all of the script is placed that is to be run after the user
// clicks on OK in the Dimensions data entry window
runtherest = Expr( 

);


dlg = New Window("Dimensions",
	//<<Modal,
	<<Return Result,
	V list Box(
		Text Box(" "),
		Text Box("Please select the units information: " ),
		ComboChoice = RadioBox({"Ft","m"}),
		ShapeChoice = Combobox({"Rectangle/Square", "L-Shape", "U-Shape", "Oval", "Lot List Input (from a JMP File)"}, hideAll),
		Text Box(""),
	),
	V list box(
		Text Box("Please enter the following information: " ),
		tb1 = Text Box("Horizontal Length"),hl_box = Number Edit Box(0),
		tb2 = Text box("Horizontal Width"), hw_box = Number Edit Box(0),
		tb3 = Text Box("Horizontal Height"), hh_box = Number Edit Box(0),
		tb4 = Text box("Vertical Length"),vl_box = Number Edit Box(0),
		tb5 = Text Box("Vertical Width"), vw_box = Number Edit Box(0),
		tb6 = Text Box("Vertical Height"),vh_box = Number Edit Box(0),
		tb7 = Text box("Bottom Length"),bl_box = Number Edit box(0),
		tb8 = Text Box("Bottom Width"), bw_box = Number Edit Box(0),
		tb9 = Text Box("Bottom Height"), bh_box = Number Edit Box(0),
		tb10 = Text box("upper Length"),ul_box = Number Edit box(0),
		tb11 = Text Box("upper Width"), uw_box = Number Edit Box(0),
		tb12 = Text Box("upper Height"), uh_box = Number Edit Box(0),
		tb13 = Text Box("Select File Containing Lot List")
	),
	H List Box(
		Button Box("Ok",
			ShapeChoice = comboVal;
			ComboChoice = (comboChoice << get items)[comboChoice << get];
			hl = hl_box << Get;
			hw = hw_box << Get;
			hh = hh_box << Get;
			vl = vl_box << Get;
			vw = vw_box << Get;
			vh = vh_box << Get;
			bl = bl_box << Get;
			bw = bw_box << Get;
			bh = bh_box << Get;
			ul = ul_box << Get;
			uw = uw_box << Get;
			uh = uh_box << Get;	
			dlg << close window;
			runtherest;
		),
		Button Box("Cancel",
			dlg << close window;
			Throw();
		),
	),
);
hideAll;
txnelson
Super User

Re: Get a New Window with exsisting radiobuttons

There are many ways to select a data table to get your lot list.  Your method seems to work.  I am a little confused about your comment about updating the information.

 

Concerning the "runtherest", any code that you place inside of the Expr() will be executed when the OK button is click.  Try replacing the section with

runtherest = Expr(
	Show( shapechoice, combochoice, hl, hw, hh, vl, vw, vh, bl, bw, bh, ul, uw, uh, )
);

When you click on OK, the Show() function will print out to the JMP log the values that the user has selected or specified from the dialog box.  Your job will be to add the JSL into this Expr() function that will take the specified values and perform whatever analysis/graphing that your application is intended to do.

Jim

Recommended Articles