You can also use << Set Function and use the buttons reference as the "starting" point
Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");
lstCols = {"age", "weight"};
For Each({colname}, lstCols,
nw = New Window("Window - " || colname,
V List Box(
dt << Distribution(Column(Eval(colname))),
Button Box("Hide", << Set Function(Function({this},
dist_ob = this << prev sib;
show(dist_ob[OutlineBox(2)] << get title);
)));
);
);
);
Write();
and in this case for hiding the window you could just use this << Show Window(0);
Context Box can also be sometimes used:
Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");
lstCols = {"age", "weight"};
For Each({colname}, lstCols,
nw = New Window("Window - " || colname,
V List Box(
Context Box(
box:dist = dt << Distribution(Column(Eval(colname))),
Button Box("Hide",
show(Report(box:dist)[OutlineBox(2)] << get title)
);
)
);
);
);
Write();
I use all these methods (and expression evaluation) depending on the situation.
-Jarmo