Issue and how to debug:
1. Run the script
2. Check the content of HB1 and HB2 (DisplayBox[ListBox])
3. Change to Option 2 and check content of HB1 (DisplayBox[])
Quick (and dirty fix?) that could possibly help. See how I changed HB1 and HB2 reference locations and made them Expressions:
names default to here(1);
Buttons = {"Button 1", "Button 2", "Button3"};
Boxes = {"Box 1", "Box 2", "Box 3"};
HB1 = Expr(
LB_Input_1 = lineupbox(ncol(2),spacing(5));
for(i=1,i<=nitems(Buttons),i++,
label1 = char(Buttons[i]);
bblabel1 = "clb_" || char(i);
eval(parse(evalinsert("\[LB_Input_1 << append(buttonbox("^label1^", ^bblabel1^ << append(clb2 << get selected)))]\")));
eval(parse(evalinsert("\[LB_Input_1 << append(^bblabel1^ = col list box("Numeric",minitems(1),maxitems(1),nlines(1)))]\")));
);
for(i=1,i<=nitems(Boxes),i++,
label1 = char(Boxes[i]);
neblabel1 = "neb_"||char(i);
eval(parse(evalinsert("\[LB_input_1 << append(Text box("^label1^"))]\")));
eval(parse(evalinsert("\[LB_input_1 << append(^neblabel1^ = Number edit box())]\")));
);
hlistbox(
clb2 = filter col selector(dt1,all),
LB_input_1
);
);
HB2 = Expr(
LB_Input_2 = lineupbox(ncol(2),spacing(5));
for(i=1,i<=nitems(Buttons)-1,i++,
label1 = char(Buttons[i]);
bblabel1 = "clb_" || char(i);
eval(parse(evalinsert("\[LB_Input_2 << append(buttonbox("^label1^", ^bblabel1^ << append(clb2 << get selected)))]\")));
eval(parse(evalinsert("\[LB_Input_2 << append(^bblabel1^ = col list box("Numeric",minitems(1),maxitems(1),nlines(1)))]\")));
);
for(i=1,i<=nitems(Boxes)-1,i++,
label1 = char(Boxes[i]);
neblabel1 = "neb_"||char(i);
eval(parse(evalinsert("\[LB_input_2 << append(Text box("^label1^"))]\")));
eval(parse(evalinsert("\[LB_input_2 << append(^neblabel1^ = Number edit box())]\")));
);
hlistbox(
clb2 = filter col selector(dt1,all),
LB_input_2
);
);
dt1 = current data table();
new window("Test",
vb1 = vlistbox(Text box(""),
Panel Box("Selection Option",H list box(text box("Select: "),
combo1 = combobox({"Option 1","Option 2"},
<< set function(function({this,index},
try(view << delete);
match(index,
1,
vb1 << append (
view = HB1;
),
2,
vb1 << append (
view = HB2;
)
)
))
)
)
),
text box (""),
view = HB1;
)
);
-Jarmo