(
// 2 tabs proof of concept, hiding and showing views
~gwin = Window.new("Test visibility", Rect(120, 420, 500, 200));
~gwin.front;
~viewOne = View.new(~gwin, Rect(50,50,280,140))
.background_(Color.gray(0.4,1))
.visible_(0);
Slider(~viewOne, Rect(5,50,20,50));
~viewTwo = View.new(~gwin, Rect(50,50,280,140))
.background_(Color.gray(0.4,1))
.visible_(0);
Slider2D(~viewTwo, Rect(20,20,100,100));
b = Button(~gwin, Rect(50, 10, 80, 35))
.states_([
["one"],
["one", Color.white, Color.gray(0.4)]
])
.action_({arg butt;
switch(butt.value,
0, { ~viewOne.visible = 0; postln("off")
},
1, { ~viewOne.visible = 1; postln("on");
b.enabled_(0);
c.enabled_(1);
~viewTwo.visible = 0;
c.valueAction = 0;
}
);
butt.value.postln;
});
c = Button(~gwin, Rect(140, 10, 80, 35))
.states_([
["two"],
["two", Color.white, Color.gray(0.4,1)]
])
.action_({arg butt;
switch(butt.value,
0, { ~viewTwo.visible = 0; postln("off")
},
1, { ~viewTwo.visible = 1; postln("on");
c.enabled_(0);
b.enabled_(1);
~viewOne.visible = 0;
b.valueAction = 0;
}
);
butt.value.postln;
});
)