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
Jackie_
Level VI

Need Help with Row state handler or event handler

Hi,

 

I am working on creating an event handler function that will switch to the histogram tab and scroll to the process distribution when a row in the process table within the summary tab is selected.

For example, if I click on “PNP4” in the table, the function should automatically switch to the histogram tab and scroll to the specific location displaying that process distribution. Any suggestions?

Jackie__1-1731594438015.png

 

Jackie__2-1731594645758.png

 

Here is the jsl code:

 

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Semiconductor Capability.jmp" );
col_names = dt << get column group( "Processes" );
tab = dt << Tabulate( Add Table( Column Table( Statistics( Mean, Std Dev ) ), Row Table( Analysis Columns( Eval( col_names ) ) ) ) );
dt2 = tab << Make Into Data Table;

tab << close window;

nw = New Window( "", 
	
	<<Type( "Dialog" ),
	<<onclose(
		rs = 0;
		1;
	),
	Panel Box( , 
		
	
		tabbb= Tab Box(
		
		
			"Summary",
			V Scroll Box(
				
				tbbox = Table Box(
					String Col Box( "Tests", (dt2:Analysis Columns << get values) ), 
								
					Number Col Box( "Mean", (dt2:Mean << get values) ),
					Number Col Box( "Std Dev", (dt2:Std Dev << get values) ), 
					
					
				)
			), 
					
					
			"Histogram", 
					
			vsb = V Scroll Box(
						
				V List Box(
							
							
					For Each( {col, idx}, col_names,
						 dt << distribution(
							Stack( 1 ),
							Continuous Distribution(
								Column( col_names[idx] ),
								Horizontal Layout( 1 ),
								Normal Quantile Plot( 1 ),
								Customize Summary Statistics(
									Std Err Mean( 0 ),
									Upper Mean Confidence Interval( 0 ),
									Lower Mean Confidence Interval( 0 )
								),
								Vertical( 1 ),
								Process Capability( 0 )
			
							)
						)
					)
				)
			)
					
		)
	)
);
Close( dt2, nosave );

tabboxxpath = nw << XPath("//TabPageBox[text()='Summary']//TableBox");
tabboxxpath <<  Set Selectable Rows( 1 );

fun = Function( {a},
tabbb << set selected ( 2 );
vsb << Set Scroll Position( 0, 200 );

);

rs = tbbox << make row state handler( fun );

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
jthi
Super User

Re: Need Help with Row state handler or event handler

Most likely there are better options, but here is one

Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Semiconductor Capability.jmp");
col_names = dt << get column group("Processes");
tab = dt << Tabulate(
	Add Table(Column Table(Statistics(Mean, Std Dev)), Row Table(Analysis Columns(Eval(col_names))))
);
dt2 = tab << Make Into Data Table;

tab << close window;

nw = New Window("",
	<<onclose(
		rs = 0;
		1;
	),
	Panel Box(,
		tb = Tab Box(
			Tab Page Box(
				"Summary",
				V Scroll Box(
					tbbox = Table Box(
						String Col Box("Tests", (dt2:Analysis Columns << get values)),
						Number Col Box("Mean", (dt2:Mean << get values)),
						Number Col Box("Std Dev", (dt2:Std Dev << get values)),
						<<Set Selectable Rows(1)
					)
				)
			),
			Tab Page Box(
				"Histogram",
				vsb = V Scroll Box(
					V List Box(
						For Each({col, idx}, col_names,
							dist = dt << distribution(
								Stack(1),
								Continuous Distribution(
									Column(col_names[idx]),
									Horizontal Layout(1),
									Normal Quantile Plot(1),
									Customize Summary Statistics(
										Std Err Mean(0),
										Upper Mean Confidence Interval(0),
										Lower Mean Confidence Interval(0)
									),
									Vertical(1),
									Process Capability(0)
				
								)
							)
						)
					)
				)
			)
		)
	)
);
Close(dt2, nosave);

rep_height = dist << get height;

fun = Function({a},
	r = a << Get Selected Rows;
	tb << set selected(2);
	vsb << Set Scroll Position(0, (r[1] - 1) * rep_height);
);

rs = tbbox << Set Row Change Function(fun);
-Jarmo

View solution in original post

5 REPLIES 5
hogi
Level XII

Re: Need Help with Row state handler or event handler

I know row state handlers in the context of data tables:

hogi_0-1731596668432.png

 

Interesting, the table box "understands" the command as well - the sense of : doesn't complain.

But it doesn't seem to react on it ...

 

Curious to see the solution ...
How are the Handlers implemented for the official reports?
via Mouse Box()?



jthi
Super User

Re: Need Help with Row state handler or event handler

Table Box uses << set row change function instead of row state handler. Do you have to the "list" view of distributions in a scrollbox (instead you could for example just create one distribution and hidden column switcher to change the column)?

-Jarmo
hogi
Level XII

Re: Need Help with Row state handler or event handler

cool : )

Supercharge Your User Interfaces in JSL ( US 2018 113 ) 

Names Default To Here( 1 );

nw = New Window( "",
	<<Type( "Dialog" ),
		tbbox = Table Box(
			String Col Box( "string", {"A", "B"} ), 						
			Number Col Box( "num", {1, 2} ), << set selectable rows()
		) 
		
);

fun= Function({this},
	Caption("hello\!N"|| Char(this<< get selected rows))
);

tbbox << set row change function( fun);

 

Jackie_
Level VI

Re: Need Help with Row state handler or event handler

Hi Jarmo,

 

Yes, I want to have a list view in the tab scroll box, not the column switcher. 

 

jthi
Super User

Re: Need Help with Row state handler or event handler

Most likely there are better options, but here is one

Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Semiconductor Capability.jmp");
col_names = dt << get column group("Processes");
tab = dt << Tabulate(
	Add Table(Column Table(Statistics(Mean, Std Dev)), Row Table(Analysis Columns(Eval(col_names))))
);
dt2 = tab << Make Into Data Table;

tab << close window;

nw = New Window("",
	<<onclose(
		rs = 0;
		1;
	),
	Panel Box(,
		tb = Tab Box(
			Tab Page Box(
				"Summary",
				V Scroll Box(
					tbbox = Table Box(
						String Col Box("Tests", (dt2:Analysis Columns << get values)),
						Number Col Box("Mean", (dt2:Mean << get values)),
						Number Col Box("Std Dev", (dt2:Std Dev << get values)),
						<<Set Selectable Rows(1)
					)
				)
			),
			Tab Page Box(
				"Histogram",
				vsb = V Scroll Box(
					V List Box(
						For Each({col, idx}, col_names,
							dist = dt << distribution(
								Stack(1),
								Continuous Distribution(
									Column(col_names[idx]),
									Horizontal Layout(1),
									Normal Quantile Plot(1),
									Customize Summary Statistics(
										Std Err Mean(0),
										Upper Mean Confidence Interval(0),
										Lower Mean Confidence Interval(0)
									),
									Vertical(1),
									Process Capability(0)
				
								)
							)
						)
					)
				)
			)
		)
	)
);
Close(dt2, nosave);

rep_height = dist << get height;

fun = Function({a},
	r = a << Get Selected Rows;
	tb << set selected(2);
	vsb << Set Scroll Position(0, (r[1] - 1) * rep_height);
);

rs = tbbox << Set Row Change Function(fun);
-Jarmo