Since I use this Col List Box to cast columns in many different roles using buttons and another Col List Boxes (as in any platform), I need to re-create MANY col list boxes, with different settings etc. So I wrote an universal function for that:
refreshDisplayBox = Function({dt, box, expr},
parent = box << Parent;
box << Delete Box;
parent << Append(box = expr);
Return (box);
);
dt is needed here in case if it is used in expr to re-create the Display Box. It gets passed into the function regardless of what handle for that table you're using outside of the function. Just need to remember to write all the expressions with "dt" for that.
Then the script is going to look like this:
Names Default To Here( 1 );
refreshDisplayBox = Function({dt, box, expr},
parent = box << Parent;
box << Delete Box;
parent << Append(box = expr);
Return (box);
);
colListExpr = Expr(Col List Box(dt/*use generic dt*/, all));
open = Expr(dtEXT/*different table name*/ = Open( "$SAMPLE_DATA/Big Class.jmp" ); lb = refreshDisplayBox(dtEXT/*pass it into the function*/, lb, colListExpr));
gui = Expr(V List Box(btn = Button Box ("OPEN", open), pb = Panel Box("Column List", lb = Col List Box())));
New Window( "Col List Box Example",
gui;
);
Let me know if this is a valid approach.