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

Can the listbox have a select all command

What inspired this wish list request? 

Can the listbox have a select all command, at the moment you can only select one by one. Use lb<<set selected(1)

 

What is the improvement you would like to see? 

listbox has a command to select all elements at once.

 

Why is this idea important? 

Many commands have this, but listbox does not; for example, checkbox

 

4 Comments
SamGardner
Level VII
Status changed to: Acknowledged

Thanks for the idea @lehaofeng. We will look into this.

As a workaround, you can use a short script to do this

Names Default To Here( 1 );

New Window( "List Box", Outline Box( "List Box", lb = List Box( {"a", "b", "c"} ) ) );

For( i = 1, i <= N Items( lb << get items ), i++,
	lb << set selected( i )
);

and you could make a function to do this

Names Default To Here( 1 );

New Window( "List Box", Outline Box( "List Box", lb = List Box( {"a", "b", "c"} ) ) );


listbox_select_all = Function( {listboxref},
	{i},
	Try(
		If( listboxref << class name() == "ListBoxBox",
			For( i = 1, i <= N Items( listboxref << get items ), i++,
				listboxref << set selected( i )
			)
		)
	)
	
);

listbox_select_all(lb);
SamGardner
Level VII
Status changed to: Investigating
 
lehaofeng
Level V

Thanks, tried it with the method you provided and it is very slow. Because there are scripts in the list box that set the row state of the table, and the selected elements, corresponding to the rows in the table, are hidden and excluded, so when I have 4000 elements in my listbox, it is very slow.

SamGardner
Level VII
Status changed to: We like it! (in the queue)

This looks like something that we can do in a future release.  We will follow up when we decide when to add this capability.