cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Choose Language Hide Translation Bar
lala
Level VII

Can JMP automatically run JSL when the cursor clicks on a cell?

 

For example, automatically runs the specified JSL when the cursor clicks on a cell?

 

Thanks!

4 REPLIES 4
ErraticAttack
Level VI

Re: Can JMP automatically run JSL when the cursor clicks on a cell?

Yes.

 

See the item "Web" in the JMP Scripting Index:

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
dt:age << Set Property( "Event Handler", Event Handler( Click( JSL Quote( Function( {dt, col, row}, Caption( "You clicked on row " || Char( row ) ); Wait( 1 ); Caption( Remove ) ) ) ) ) )
Jordan
lala
Level VII

Re: Can JMP automatically run JSL when the cursor clicks on a cell?

wonderful

Thanks!

2023-07-26_22-30-00.png

lala
Level VII

Re: Can JMP automatically run JSL when the cursor clicks on a cell?

I'd like to move on to a more specific example:
dt=Open("$SAMPLE_DATA/Hair Care Product.jmp");


How to click on a cell in column 1, column 2 range
How to write JSL to implement:
1, automatically assign the value of this cell to the variable,
2, and then in the first column, the second column in the range of rows are this value of the cells to change the color of the cell to pink, not this value to cancel the color.
For example, in my screenshot, I clicked dt[1175,1].

 

Thanks!

2023-07-27_11-49-48.png

lala
Level VII

Re: Can JMP automatically run JSL when the cursor clicks on a cell?

dt = Current Data Table();
ab = (dt << get selected rows)[1];
aaa = Column( dt, (dt << get selected columns)[1] )[(dt << get selected rows)[1]];
r = N Row( dt );
i = 1;
j = 1;
For( j = 1, j <= r, j++,
	For( i = 1, i <= 2, i++,
		If( dt[j, i ] == aaa,
			Column( i  ) << Color Cells( "red", j ),
			Column( i  ) << Color Cells( "white", j )
		)
	)
);
  • This is the only script I can write.