Another way of handling this, is to completely hide the outline box of interest, rather than closing it; The button box can then redisplay the outline box, rather than opening it. This is all done using the Visibility element available to the Outline Box() object.
Names Default To Here( 1 );
dt =
// Open Data Table: Big Class.jmp
// → Data Table( "Big Class" )
Open( "/C:/Program Files/SAS/JMPEA/17/Samples/Data/Big Class.jmp" );
ow = Oneway(
Y( :height ),
X( :age ),
Means( 1 ),
Box Plots( 1 ),
Mean Diamonds( 1 )
);
nw = New Window( "My Display",
<<journal,
bb = Button Box( "Display Anova",
nw["Oneway Anova"] << visibility( switch );
If( switch == "visible",
switch = "collapse";
bb << set button name( "Hide Anova" );
,
switch = "visible";
bb << set button name( "Display Anova" );
)
;
)
);
Report( ow ) << journal;
ow << close window;
switch = "visible";
nw["Oneway Anova"] << visibility( "collapse" );
Jim