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

how to remove items from list box

runScriptFilter = Function( {filterWord},
	{},
	If( filterWord == "FE",
		selected = {"1", "2", "3"}
	);
	If( filterWord == "SSAFI",
		selected = {"4", "5", "6"}
	);
	If( filterWord == "BE",
		selected = {"7", "8", "9"}
	);
	Return( selected );
);

//title and gui
lub1 = Lineup Box( N Col( 3 ), spacing( 5 ),
	Spacer Box( size( 0, 0 ) ),
	Spacer Box( size( 0, 0 ) ),
	Spacer Box( size( 0, 0 ) ), 
	//button and text
	Button Box( "BE", b << append( runScriptFilter( "BE" ) ) ),
	Button Box( "SSAFI", b << append( runScriptFilter( "SSAFI" ) ) ),
	Button Box( "FE", b << append( runScriptFilter( "FE" ) ) ), 
	//H Center Box( text = Text Box( "Select column that will compared with indicators" ) ),
	b = List Box(),
	b << Set height( 400 );
	b << Set Width( 400 );
	
);
pb1 = Panel Box( "GM EOL", lub1 );
myWindow = New Window( "GM EOL", Show Menu( 0 ), show toolbars( 0 ), Border Box( Top( 20 ), Bottom( 20 ), Left( 20 ), Right( 20 ) ), pb1 );

I have a script which I simplified a little 

the append works great, but I want before appending a list, that it will clear the current state

 

clicking all the buttons gives me this:

itzikd_0-1621503503556.png

 

but I actually want it to give me only 3 numbers and not 9 (the last button I clicked)

1 ACCEPTED SOLUTION

Accepted Solutions
jthi
Super User

Re: how to remove items from list box

You will have to clear b before appending to it (or rebuild it).

 

You could for example set it as empty before append:

Button Box( "BE", b << set items({}); b << append( runScriptFilter( "BE" ) ) ),
-Jarmo

View solution in original post

2 REPLIES 2
jthi
Super User

Re: how to remove items from list box

You will have to clear b before appending to it (or rebuild it).

 

You could for example set it as empty before append:

Button Box( "BE", b << set items({}); b << append( runScriptFilter( "BE" ) ) ),
-Jarmo
itzikd
Level III

Re: how to remove items from list box

Thanks that works great!
Tried with delete before and it like removed the whole box so i guess i just needed to set an empty list

Recommended Articles