Here are 2 examples. The first one is using a Col List Box. It requires the additional fruit choices to be column names, so that they will show up in the Col List Box as choices to be added to the Fruits list.
Names Default To Here( 1 );
dt=new table("New Fruits",
new column("Bananas"),
new column("Oranges")
);
Fruits = {"apple", "mango", "strawberry"};
New Window( "Example",
lb = col List Box(dt,all,
width( 200 ),
max selected( 1 ),
nlines( 6 ),
selList = lb << get selected;
locList = lb << get selected indices;
If( Contains( Fruits, selList[1] ) == 0,
Insert Into( Fruits, selList[1] )
);
lb << set selected(locList[1],0);
show(Fruits);
)
);
This seems to be an inefficient way to code this, unless the choices you want to make are actually column names. If they are not column names that need to be selected, then by using just a List Box() will work just fine
Names Default To Here( 1 );
Fruits = {"apple", "mango", "strawberry"};
New Window( "Example",
lb = List Box(
{"Banana", "Orange"},
width( 200 ),
max selected( 1 ),
nlines( 6 ),
selList = lb << get selected;
locList = lb << get selected indices;
If( Contains( Fruits, selList[1] ) == 0,
Insert Into( Fruits, selList[1] )
);
lb << set selected(locList[1],0);
show(Fruits);
)
);
Jim