1 title:: Resize behaviour
2 summary:: Resize behavior for SCView and its subclasses
7 The SCView link::Overviews/Methods#resize#resize method:: takes nine different arguments defining the behavior when window is resized. Each view responds relatively to the stretches of its parent view.
16 ## 1 - fixed to left, fixed to top
17 ## 2 - horizontally elastic, fixed to top
18 ## 3 - fixed to right, fixed to top
20 ## 4 - fixed to left, vertically elastic
21 ## 5 - horizontally elastic, vertically elastic
22 ## 6 - fixed to right, vertically elastic
24 ## 7 - fixed to left, fixed to bottom
25 ## 8 - horizontally elastic, fixed to bottom
26 ## 9 - fixed to right, fixed to bottom
33 // use the PopUpMenus to mix resize modes
41 w = Window("resize:"+i, Rect(10 + (k%3 * 220), Window.screenBounds.height- [250,460,670].at(k/3), 200, 180));
43 x = CompositeView(w, w.view.bounds.insetBy(20,20))
44 .background_(Color.rand)
47 y = CompositeView(x, x.bounds.moveTo(0,0).insetBy(20,20))
48 .background_(Color.rand)
51 y.decorator = FlowLayout(y.bounds).gap_(0.0 @ 0.0);
53 t = StaticText(y, Rect(0, 0, 40, 40))
54 .background_(Color.rand.alpha_(0.8))
57 .font_(Font("Helvetica", 26));
59 p=PopUpMenu(y,40@40).items_((1..9).collect(_.asString)).value_(i-1).resize_(i)
60 .action_{|m| t.string_((m.value+1).asString); [p,t].do(_.resize_(m.value+1))};
63 w.onClose = {a.do(_.close) };
69 // the popupmenu contains the various modes
72 w = Window("soundfile test", Rect(200, 200, 720, 250));
74 p = PopUpMenu(w, Rect(10,10,80,24))
75 .items_( Array.fill(9, {arg i; (i+1).asString;}) )
77 a.resize_(sbs.value+1);
81 f.openRead(Help.dir +/+ "sounds/a11wlk01.wav");
83 a = SoundFileView(w, Rect(10,40, 700, 180))
85 .readWithTask(0, f.numFrames, showProgress: false )