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

How to "click" combo box item using JSL

Dear community,

I am trying to select an item in a combo box and "click" it using jsl. I know how this works for a "Button Box", but it seems that another approach is needed. Here is the example:

I want to be able to select an item in the combo box AND execute the combo box script by pressing the button. The text box just shows the combo box selection. Now, running the below script will change the combo box selection, but it does not run the script. This is evedint because the text box does not change its number.

 

 

New Window( "Example",
	V List Box(
		CB = Combo Box(
			{"Select", "1", "2"}, 
					TB << Set Text( CB << Get Selected() )
		),
		TB = Text Box( "Select" ),
		BB = Button Box("Set Combo Box to 1",
			CB << set(2)
		)
	)
)

 

 

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
vince_faller
Super User (Alumni)

Re: How to "click" combo box item using JSL

use the run script(1) command on the set. 

 

Names Default to here(1);
New Window( "Example",
	V List Box(
		CB = Combo Box(
			{"Select", "1", "2"}, 
					TB << Set Text( CB << Get Selected() )
		),
		TB = Text Box( "Select" ),
		BB = Button Box("Set Combo Box to 1",
			CB << set(2, runscript(1))
		)
	)
)
Vince Faller - Predictum

View solution in original post

3 REPLIES 3
pmroz
Super User

Re: How to "click" combo box item using JSL

Seems like that should work but it doesn't.  You can accomplish that by putting the combo box select actions into an expression, and then executing them in both places:

cb_expr = expr(TB << Set Text( CB << Get Selected()));

New Window( "Example",
	V List Box(
		CB = Combo Box(
			{"Select", "1", "2"}, 
					cb_expr;
		),
		TB = Text Box( "Select" ),
		BB = Button Box("Set Combo Box to 1",
			CB << set(2);
			cb_expr;
		)
	)
);
vince_faller
Super User (Alumni)

Re: How to "click" combo box item using JSL

use the run script(1) command on the set. 

 

Names Default to here(1);
New Window( "Example",
	V List Box(
		CB = Combo Box(
			{"Select", "1", "2"}, 
					TB << Set Text( CB << Get Selected() )
		),
		TB = Text Box( "Select" ),
		BB = Button Box("Set Combo Box to 1",
			CB << set(2, runscript(1))
		)
	)
)
Vince Faller - Predictum
martin_snogdahl
Level III

Re: How to "click" combo box item using JSL

Very simple, thank you.