Hi all,
I want to creat a window with two depanded radio box.
the 1st redio box will ask the user to choose a number between 1 to 3
then, based on the user selection, a new redio box will pop up below the 1st radio box with the flowing rouls:
if user select "1" --> the 2nd radio box will contain 2 options "a" and "b".
if user select "2" --> the 2nd radio box will contain 3 options "a" , "b" and "c".
if user select "3" --> the 2nd radio box will contain 4 options "a" , "b" ,"c" and "d".
the idea is to learn how to add a new radio selection box based on user input
thanks!:)
Here are a couple of ways to do this.....others exist too
Names Default To Here( 1 );
rad1 = Radio Box( {"a"} );
rad2 = Radio Box( {"a", "b"} );
rad3 = Radio Box( {"a", "b", "c"} );
New Window( "Test",
vlb = V List Box(
radtest = Radio Box(
{"One", "Two", "Three"},
If(
radtest << get == 1,
Try( vlb[Radio Box( 2 )] << delete );
vlb << append( rad1 << clone box );,
radtest << get == 2,
Try( vlb[Radio Box( 2 )] << delete );
vlb << append( rad2 << clone box );,
radtest << get == 3,
Try( vlb[Radio Box( 2 )] << delete );
vlb << append( rad3 << clone box );
)
)
)
);
New Window( "Test2",
vlb = V List Box(
radtest2 = Radio Box(
{"One", "Two", "Three"},
If(
radtest2 << get == 1,
rad12 << visibility( Visible );
rad22 << visibility( Collapse );
rad32 << visibility( Collapse );,
radtest2 << get == 2,
rad22 << visibility( Visible );
rad12 << visibility( Collapse );
rad32 << visibility( Collapse );,
radtest2 << get == 3,
rad32 << visibility( Visible );
rad12 << visibility( Collapse );
rad22 << visibility( Collapse );
)
),
rad12 = Radio Box( {"a"} ),
rad22 = Radio Box( {"a", "b"} ),
rad32 = Radio Box( {"a", "b", "c"} )
)
);
rad12 << visibility( collapse );
rad22 << visibility( collapse );
rad32 << visibility( collapse );