It would be more conventional to use column list boxes, but if you do need a combo box then try:
NamesDefaultToHere(1);
// Make a table
dt =
New Table( "Data",
Add Rows( 0 ),
New Column( "sales",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Values( [] )
),
New Column( "quantity sold",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Values( [] )
)
);
// Get the column names in dt into a list
cols = dt << getColumnNames("String");
// Make a UI
nw =
NewWindow("Select a column from "||(dt << getName),
cb = comboBox(cols),
ButtonBox("OK", OKscript)
);
nw << sizeWindow(300, 200);
// Recover the selection from the UI
OKscript =
Expr(
nw << closeWindow;
myCol = cols[cb << get];
Print(myCol);
);