cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • New to JMP? Join us Sept. 23-24 for the Early User Edition of Discovery Summit, tailor-made for new users. Register now for free!
  • Your voice matters! Tell us how you prefer to receive JMP updates, so we can tailor our communication to your needs. Take short survey.
  • See how to access JMP Marketplace - and - find, create & share add-ins to extend your JMP. Watch video.

Discussions

Solve problems, and share tips and tricks with other JMP users.
Choose Language Hide Translation Bar
EOwl
Level II

Conditionally include box elements in a New Window();

I'm creating a custom column select GUI using New Window(), and the list of columns that need to be selected depend on the option selected in a previous window. How do I conditionally set which Box elements exist in the window? (in the figure, only orange exists if single was selected, only green if double).

Screenshot 2026-07-23 114555.png

 

 

 

 

 

 

 

I've tried something with Match() (commented out in the script) but no luck.

 

Clear Globals();
Names Default To Here(1);

// Config.
window_Radio = New Window( "Wafermap viewer config.",
	<<modal,
	<<Size Window( 350, 200 ), 
	
	Border Box( Left( 3 ), top( 10 ),
	
	// Select Level
		vb = V List Box(
		
			pb = Panel Box( "Select data configuration",
				Lineup Box( N Col( 2 ), spacing( 10 ), 
					rb1 = Radio Box( {"Single"} ),
					rb2 = Radio Box( {"Double"} )
				),
				<<Set Stretch( "Fill", "Off" )
			),
		
			Spacer Box( size( 0, 10 ) ), 
		
			H List Box(
				okbtn = Button Box( "OK", option = rb1 << Get();)
				, exitbtn = Button Box( "Cancel", /*window_Radio << CloseWindow*/)
			),
			<<Set Stretch( "Fill", "Off" )
		)
	),
	
	rb1 << group( rb2 );	
);

//If cancelled stop script
if (window_Radio["Button"] != 1, stop());

dt = Open( "$SAMPLE_DATA/Big Class.jmp" );

colbox_width = 130;


window_colselect = New Window("Select identifying columns",
	<< Type( "Dialog" ),
	Border Box( Left( 3 ), top( 10 ),
		V List Box(
			H List Box(
				V List Box(
					Panel Box( "Select Column(s)",
						colListData = Col List Box( dt, All
							, width( colbox_width ), nLines( Min( N Col( dt ), 10 ) ) 
							)
					)
				),
				V List Box(
					Panel Box( "Column Role(s)",
						Lineup Box( N Col( 2 ), Spacing( 3 ),

/*							//####Conditional JSL Attempt####
							Match(option,
							1, Expr(
							//Single col select
							btnLotID = Button Box( "Lot", colListLotID << Append( colListData << GetSelected ) ),
							colListLotID = Col List Box( width( colbox_width ), minitems( 1 ), nLines( 1 ), character ),
							),
							2, Expr(
							//Select col 1
							btnLotRoot = Button Box( "Lot Root", colListLotRoot << Append( colListData << GetSelected ) ),
							colListLotRoot = Col List Box( width( colbox_width ), minitems( 1 ), nLines( 1 ), character ),
							//Select col 2
							btnBatch = Button Box( "Batch", colListBatch << Append( colListData << GetSelected ) ),
							colListBatch = Col List Box( width( colbox_width ), minitems( 1 ), nLines( 1 )),
							)
							*/
							
							
							//####### option = 1 #########
							//Single col select
							btnLotID = Button Box( "Lot", colListLotID << Append( colListData << GetSelected ) ),
							colListLotID = Col List Box( width( colbox_width ), minitems( 1 ), nLines( 1 ), character ),

							//####### option = 2 #########
							//Select col 1
							btnLotRoot = Button Box( "Lot Root", colListLotRoot << Append( colListData << GetSelected ) ),
							colListLotRoot = Col List Box( width( colbox_width ), minitems( 1 ), nLines( 1 ), character ),
							//Select col 2
							btnBatch = Button Box( "Batch", colListBatch << Append( colListData << GetSelected ) ),
							colListBatch = Col List Box( width( colbox_width ), minitems( 1 ), nLines( 1 )),

						)
					)
				),
				Panel Box( "Action",
					Lineup Box( N Col( 1 ),
						Button Box( "OK", /*OK Actions*/),
						Button Box( "Cancel", /*Cancel Actions*/),
						Button Box( "Reset", /*Reset Actions*/),

						Spacer Box( size( 0, 10 ) ), 

						Button Box( "Remove", /*Remove Actions*/),
						Button Box( "Recall", /*Recall Actions*/)
					)
				)
			)
		)
	)
);

Sidebar, I can't get the panel box with the radio buttons to stretch to fill the window, how can I do that without manually matching the window size?

 

1 ACCEPTED SOLUTION

Accepted Solutions
jthi
Super User

Re: Conditionally include box elements in a New Window();

If Box() is one quite easy option to use

Names Default To Here(1);
New Window("Example",
	H List Box(
		englishBox = If Box(1, Text Box("Good day")),
		frenchBox = If Box(0, Text Box("Bon Jour"))
	)
);
Wait(5);
englishBox << Set(0);
frenchBox << Set(1);

 

-Jarmo

View solution in original post

2 REPLIES 2
jthi
Super User

Re: Conditionally include box elements in a New Window();

If Box() is one quite easy option to use

Names Default To Here(1);
New Window("Example",
	H List Box(
		englishBox = If Box(1, Text Box("Good day")),
		frenchBox = If Box(0, Text Box("Bon Jour"))
	)
);
Wait(5);
englishBox << Set(0);
frenchBox << Set(1);

 

-Jarmo
jthi
Super User

Re: Conditionally include box elements in a New Window();

For the panel box stretching I think you could for example add "blank" Spacer box as the first display box 

Names Default To Here(1);

window_Radio = New Window("Wafermap viewer config.",
	<<Type("Modal Dialog"),
	<<Size Window(350, 200), 
	Spacer Box(<< Set Stretch("Window", "Off")),
	Border Box(Left(3), top(10), 
		vb = V List Box(
			pb = Panel Box("Select data configuration",
				Lineup Box(N Col(2), spacing(10), 
					rb1 = Radio Box({"Single"}), 
					rb2 = Radio Box({"Double"})
				),
				<<Set Stretch("Fill", "Off")
			), 
			Spacer Box(size(0, 10)), 
			H Center Box(Lineup Box(N Col(2),
				okbtn = Button Box("OK", option = rb1 << Get()), 
				exitbtn = Button Box("Cancel", /*window_Radio << CloseWindow*/)
			)),
			<<Set Stretch("Fill", "Off")
		)
	), 	
	rb1 << group(rb2)
);

 

-Jarmo

Recommended Articles