class library: quit internal server on class library compilation
[supercollider.git] / HelpSource / Reference / Resize.schelp
blobfda188502b819ec80830b1723dfbad3f2773e16c
1 title:: Resize behaviour
2 summary:: Resize behavior for SCView and its subclasses
3 categories:: GUI
5 section:: Description
6 method:: resize
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.
9 table::
10 ## 1 || 2 || 3
11 ## 4 || 5 || 6
12 ## 7 || 8 || 9
15 list::
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
29 section:: Examples
31 code::
32 // resize behaviours
33 // use the PopUpMenus to mix resize modes
35 var a;
37 a = { |i|
38         var w, b, x,k,t,p;
39         k=i;
40         i = i + 1;
41         w = Window("resize:"+i, Rect(10 + (k%3 * 220), Window.screenBounds.height- [250,460,670].at(k/3), 200, 180));
42         b = w.view.bounds;
43         x = CompositeView(w, w.view.bounds.insetBy(20,20))
44                 .background_(Color.rand)
45                 .resize_(i);
47         y = CompositeView(x, x.bounds.moveTo(0,0).insetBy(20,20))
48                 .background_(Color.rand)
49                 .resize_(i);
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))
55                 .resize_(i)
56                 .string_(i)
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))};
62         w.front;
63         w.onClose = {a.do(_.close) };
65 } ! 9;
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;}) )
76         .action_({ arg sbs;
77                 a.resize_(sbs.value+1);
78         });
80 f = SoundFile.new;
81 f.openRead(Help.dir +/+ "sounds/a11wlk01.wav");
83 a = SoundFileView(w, Rect(10,40, 700, 180))
84         .soundfile_(f)
85         .readWithTask(0, f.numFrames, showProgress: false )
86         .resize_(1);
88 w.front;