Try this code:
// Preload the table combobox with a list of existing tables
default_table = current data table() << get name;
table_list = {};
ntables = ntable();
For (i = 1, i <= ntables, i++,
one_name = Data Table(i) << Get Name;
table_list[i] = one_name;
// For the default table load up the columns list box
if (one_name == default_table,
idefault = i;
col_list = data table(i) << get column names (as string);
);
);
nw = new window("Test",
select_table_combo = combobox(table_list,
// This function is called when the Combo Box selection changes
selectedIndex = select_table_Combo << Get Selected;
col_list = data table(selectedIndex) << get column names (as string);
// columns_listbox << remove all;
columns_listbox << set items(col_list);),
columns_listbox = listbox(col_list);
);