Notifications
Clear all

[Closed] Listbox append new selection

Hi there

I have a problem with appending new selection to the previous listbox items
here it is

 try(destroyDialog list) catch()
    rollout list "" width:200 height:200
    (
  	  listbox list ""
  	  button add "add"
  	  
  	  on add pressed do
  	  (
  		crsel=for foo in selection collect foo.name 	
  		list.items=crsel
  	  )	  
    )
    createdialog  list

it adds selections to the listbox but when you have another selection set and want to append the new selection set to the previous items it replace not append.

Thanks in advance

3 Replies
try(destroyDialog list) catch()
  rollout list "" width:200 height:200
  (
  	local toDisplay = #()
  	listbox list ""
  	button add "add"
  
  	on add pressed do
  	(
  		crsel=for foo in selection collect foo.name
  		toDisplay = makeUniqueArray (join toDisplay crsel)
  		list.items=toDisplay
  	)	  
  )
  createdialog  list
  

Thanks so much paul

Thanks so much for the reply