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

Use JSL to select a tab in a window

Hi all,

 

I am using JSL to create a window with multiple tabs in it.  I'd like to have the user select from the combo box (that has the tab names in it) and based upon the selection make that tab come to the front, as if they had clicked on the tab.  The script I've shown below is just an example I made up to demonstrate my issue. I've tried using both "bring window to front" and "show window" but neither work.

 

I am using JMP version 17.1.

 

names default to here (1);

nw = new window("example",
	<<modal,
	v list box(
		tab box(
			tab page box("Selection",
				v list box(
					Text box("Choose your tab:"),
					cb.tab = combo box({"Click to choose:", "Tab1", "Tab2"},
						tab_selection = cb.tab << get selected();
						if( tab_selection == "Tab1",
								tpb.tab1 << bring window to front;
							,
							tab_selection == "Tab2",
								tpb.tab2 << show window;
						);
					),
				),
			),
			tpb.tab1 = tab page box("Tab1"),
			tpb.tab2 = tab page box("Tab2"),
		),
		h list box(
			button box("OK"),
			bbc = button box("Cancel"),
		),
	),
);

if(nw == {Button(-1)}, stop() );

 

1 ACCEPTED SOLUTION

Accepted Solutions

Re: Use JSL to select a tab in a window

Hi @tbidwell 

 

<< set selected( n )

This will activate the nth tab from left to right. Assign a variable name to the tab box and this should work.

 

tb = tab box(
			tab page box("Selection",
				v list box(
					Text box("Choose your tab:"),
					cb.tab = combo box({"Click to choose:", "Tab1", "Tab2"},
						tab_selection = cb.tab << get selected();
						if( tab_selection == "Tab1",
								//tpb.tab1 << bring window to front;
								tb << set selected ( 2 );
							,
							tab_selection == "Tab2",
								//tpb.tab2 << show window;
								tb << set selected( 3 )
						);
					),
				),
			),
			tpb.tab1 = tab page box("Tab1"),
			tpb.tab2 = tab page box("Tab2"),
		),

 

-Scott

View solution in original post

1 REPLY 1

Re: Use JSL to select a tab in a window

Hi @tbidwell 

 

<< set selected( n )

This will activate the nth tab from left to right. Assign a variable name to the tab box and this should work.

 

tb = tab box(
			tab page box("Selection",
				v list box(
					Text box("Choose your tab:"),
					cb.tab = combo box({"Click to choose:", "Tab1", "Tab2"},
						tab_selection = cb.tab << get selected();
						if( tab_selection == "Tab1",
								//tpb.tab1 << bring window to front;
								tb << set selected ( 2 );
							,
							tab_selection == "Tab2",
								//tpb.tab2 << show window;
								tb << set selected( 3 )
						);
					),
				),
			),
			tpb.tab1 = tab page box("Tab1"),
			tpb.tab2 = tab page box("Tab2"),
		),

 

-Scott