Panel Box() objects automatically adapt their size as the content expands. However the reverse seems not to be true. Pressing the right radio button In the example script below stretches the window as the checkbox descriptors expand. Reselecting the left radio button results in shorter descriptors but the panel box (and window) retains its expanded state.
How can I force the panel box to revert to it's orginal size? Or is there another display box type that is "smarter" in this respect?
I have tried to save the original size in a variable (using pb1 << Get Size) and apply that when radio button 1 is reselected, but Panel Box() seems not to recognize a Set Size() message.
str =
{"case 1: low dose really long description really long description really long description",
"case 2: high dose really long description really long description really long description"
};
short_str = Eval List( {Left( str[1], 6 ), Left( str[2], 6 )} );
pb1=expr(Panel Box( ,
hlb1 = V List Box(tb = Text Box( "Select Case" ),
cb = Check Box( short_str ),
vlb1 = V List Box(
Spacer Box(),
H List Box(
rb2 = Radio Box(
"Show name",
cb << delete;
vlb1 << prepend( cb = Check Box( short_str ))),
rb1 = Radio Box(
"Show description",
cb << delete;
vlb1 << prepend( cb = Check Box( str )))))))
);
pb2 = Expr(
Panel Box( ,
V List Box(
Button Box( "Run" ),
Button Box( "Cancel", << close window ),
Spacer Box()
)));
New Window( "Example",
hlb = H List Box(pb1,pb2)
);
rb2 << group( rb1 );