Here is one example where the content is added and removed dynamically. I also added an example of how to get the output from the modal dialog. In the first example using IfBox, this could be done by using <<ReturnResult and the results would appear in the output variable w. The <<ReturnResult method will not work with content that is added on the fly, so I added an <<OnClose expression to get the results from the dialog before it is dismissed.
Names Default To Here( 1 );
ui2x2 = Expr(
H List Box(
col_1 = Number Col Edit Box( , [1, 3] ),
col_2 = Number Col Edit Box( , [2, 4] ),
)
);
ui3x3 = Expr(
H List Box(
col_1 = Number Col Edit Box( , [1, 4, 7] ),
col_2 = Number Col Edit Box( , [2, 5, 8] ),
col_3 = Number Col Edit Box( , [3, 6, 9] )
)
);
results = New Namespace();
results:SampleConfig = "2 x 2";
w = New Window( "Select Sample Configuration",
<<Modal,
<<On Close(
results:col1 = col_1 << Get();
results:col2 = col_2 << Get();
if (results:SampleConfig == "3 x 3",
results:col3 = col_3 << Get();
)
),
H List Box(
Panel Box( "Select Sample Configuration",
rb = Radio Box(
{"2 x 2", "3 x 3"},
<<setfunction(
Function( {this},
results:SampleConfig = rb << Get Selected;
(pbox1 << Child()) << Delete Box;
If( results:SampleConfig == "2 x 2",
pbox1 << Append( Eval( ui2x2 ) ),
pbox1 << Append( Eval( ui3x3 ) )
);
Print( "Selection Changed!" );
Print( results:SampleConfig );
)
)
)
),
pbox1 = Panel Box( "Scribe #s", Eval( ui2x2 ) )
)
);
if (w["Button"] == 1,
results << Show Contents();,
Print("Cancelled!");
);