/usr/share/SuperCollider/HelpSource/Classes/StaticText.schelp is in supercollider-common 1:3.8.0~repack-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 | CLASS:: StaticText
summary:: A view displaying non-editable text
categories:: GUI>Views
DESCRIPTION::
A view displaying non-editable text
CLASSMETHODS::
PRIVATE:: key
INSTANCEMETHODS::
SUBSECTION:: Data
METHOD:: string
The text displayed by the view.
argument::
A String.
METHOD:: object
If link::#-setBoth:: is true, setting this variable also sets link::#-string:: to the value interpreted link::Classes/Object#-asString#as String::.
argument::
Any object, typically one which makes sense to display as a string, such as a Float.
METHOD:: setBoth
A variable stating whether setting link::#-object:: will also set link::#-string::.
argument::
A Boolean.
SUBSECTION:: Appearance
METHOD:: align
The alignment of the displayed text. See link::Reference/gui_alignments:: for possible values.
METHOD:: font
The font used to display the text.
argument::
A Font.
METHOD:: stringColor
The color used to display the text.
argument::
A Color.
METHOD:: background
Setting this variable colors the whole area occupied by the view under the text with the given color.
argument::
A Color.
EXAMPLES::
subsection:: Basic Example
code::
(
w = Window.new.front;
a = StaticText(w, Rect(10, 10, 200, 20));
a.string = "Rolof's Rolex";
)
// adjust look , alignment and content
a.background=Color.grey;
a.align = \center;
a.font = Font("Monaco", 11);
a.string = "Your Rolex";
::
subsection:: Monitoring Values in a Synth
code::
(
w = Window("Frequency Monitor", Rect(200, Window.screenBounds.height-200,300,150)).front;
a = StaticText(w, Rect(45, 10, 200, 20)).background_(Color.rand);
a.string = " Current Frequency ";
Button.new(w, Rect(45, 70, 200, 20)).states_([["close",Color.black,Color.rand]]).action_({w.close});
s.waitForBoot({
b=Bus.new(\control,0,1);
q=SynthDef(\Docs_FreqMonitor, {var freq,snd;
freq=LFNoise0.ar(2, 400, 650);
snd=SinOsc.ar(freq,0,0.2);
Out.ar(0,snd);
Out.kr(b.index,freq); // output the frequency to a control bus
}).play;
r= Routine{
{ // Set the value of the StaticText to the value in the control bus.
// Setting GUI values is asynchronous, so you must use .defer in the system clock.
// Also you must check if the window is still open, since Routine will continue for at least
// one step after you close the window.
b.get( {arg v; {w.isClosed.not.if{ a.string= " Current Frequency: "++v.round(0.01)}; }.defer} );
0.01.wait;
}.loop
}.play
});
CmdPeriod.doOnce({w.close});
w.onClose={r.stop; q.free; b.free }; //clean up if the window closes
)
::
subsection:: Dynamic Text
code::
(
w = Window.new.front;
w.view.background=Color.white;
a = Array.fill(20, {StaticText(w, Rect(w.bounds.extent.x.rand, w.bounds.extent.y.rand, 160, 16))
.string_("Rolof's Rolex".scramble)
.align_(\center)
.stringColor_(Color.rand)
.font_(Font([
"Helvetica-Bold",
"Helvetica",
"Monaco",
"Arial",
"Gadget",
"MarkerFelt-Thin"
].choose, 11))
});
r = {inf.do{|i|
thisThread.randSeed_(1284);
a.do{|item|
// setting GUI values is asynchronous, so you must use .defer
{item.bounds = Rect(5+w.bounds.extent.x.rand * (cos(i*0.01)).abs,
w.bounds.extent.y.rand * sin(i*0.01),
160, 20)}.defer;
};
0.15.wait;
}}.fork;
CmdPeriod.doOnce({w.close});
w.onClose_({r.stop});
)
::
|