cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Don’t miss your chance to experience Discovery Summit Europe at our best available rate! Early bird registration through 31 Oct.
  • Image to Table JMP extension imports single or batch images as data tables. Useful to extract curves from pictures or convert image data to curve data to use in analyses like Functional Data Explorer. Download and install the extension.

Discussions

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

Setting Default Selected Item in a Combo Box

When using a combo box, how can I set it to display the currently selected item by default? For example, if the default is the first item, which is "1", what should I do to have the combo box show "7" as the currently selected item by default, as shown in the image below?
BabyDoragon_0-1740049027630.png

 

a = {"1", "2", "3", "4", "5", "6", "7", "8", "9", "0"};
New Window( "Test", 

	testCB = Combo Box( a, )
);
 
 
2 REPLIES 2

Re: Setting Default Selected Item in a Combo Box

Hi @BabyDoragon ,

 

You can use the 'set' function to place it into the position on the list (this has to be the numbered order for the combo box list)

 

a = {"1", "2", "3", "4", "5", "6", "7", "8", "9", "0"};
New Window( "Test", 

	testCB = Combo Box( a, )
);

testcb<<set (1); //set to first position
“All models are wrong, but some are useful”
jthi
Super User

Re: Setting Default Selected Item in a Combo Box

Extending a little on bens solution

Names Default To Here(1);

options = {"1", "2", "3", "4", "5", "6", "7", "8", "9", "0"};
initial_option = "7";

nw = New Window( "Test", 
	combob = Combo Box(options, << Set(Contains(options, initial_option)))
);

Scripting Index is usually good place to start

jthi_0-1740054668783.png

 

-Jarmo

Recommended Articles