The main issue is that what is returned from the
cb << Get Selected
is not a variable name, as you were wanting it to be, but rather a string, "Fruit" or "Vegetables". That is, the names of the 2 list are Fruit and Vegetables, not "Fruit" and "Vegetables".
Below is a script that works the way you want. There are other ways to do this, that others may want to contribute
Names Default To Here( 1 );
TestArray = {"Fruit", "Vegetables"}; //my list of 'stuff'
Fruit = {"Oranges", "Apples", "Grapes"};
Vegetables = {"Corn", "Squash", "Eggplants"};
nw = New Window( "Sample",
<<modal,
vlb = H List Box(
cb = Combo Box(
TestArray,
tb2 << remove all;
If( (cb << Get Selected) == "Fruit",
tb2 << Append( Fruit ),
tb2 << Append( Vegetables )
);
),
tb2 = List Box()
)
);
Jim