Removing an old, cherished, yet pointless caveat "This documentation is
[supercollider.git] / Help / GUI / Cocoa-GUI / SCTextField.html
blobde32c428adda6a82a083e5b470623f8a61f82c3d
1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
2 <html>
3 <head>
4 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5 <meta http-equiv="Content-Style-Type" content="text/css">
6 <title></title>
7 <meta name="Generator" content="Cocoa HTML Writer">
8 <meta name="CocoaVersion" content="949.43">
9 <style type="text/css">
10 p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica}
11 p.p2 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; min-height: 14.0px}
12 p.p3 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; color: #001bec}
13 p.p4 {margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Helvetica}
14 p.p5 {margin: 0.0px 0.0px 0.0px 57.0px; text-indent: -57.0px; font: 12.0px Helvetica}
15 p.p6 {margin: 0.0px 0.0px 0.0px 57.0px; text-indent: -57.0px; font: 12.0px Helvetica; min-height: 14.0px}
16 p.p7 {margin: 0.0px 0.0px 0.0px 85.0px; text-indent: -85.0px; font: 12.0px Helvetica}
17 p.p8 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco}
18 p.p9 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color: #606060}
19 p.p10 {margin: 0.0px 0.0px 0.0px 57.0px; text-indent: -57.0px; font: 9.0px Monaco; min-height: 12.0px}
20 p.p11 {margin: 0.0px 0.0px 0.0px 57.0px; text-indent: -57.0px; font: 14.0px Helvetica}
21 p.p12 {margin: 0.0px 0.0px 0.0px 57.0px; text-indent: -57.0px; font: 14.0px Helvetica; min-height: 17.0px}
22 p.p13 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; min-height: 12.0px}
23 p.p14 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color: #ae1a19}
24 span.s1 {font: 18.0px Helvetica}
25 span.s2 {color: #6c7188}
26 span.s3 {color: #6b718a}
27 span.s4 {color: #000000}
28 span.s5 {text-decoration: underline}
29 span.s6 {color: #5a66a4}
30 span.s7 {color: #485cba}
31 span.s8 {color: #6f717f}
32 span.s9 {font: 9.0px Monaco}
33 span.s10 {color: #0016bd}
34 span.s11 {color: #6f7182}
35 span.s12 {font: 14.0px Helvetica}
36 span.s13 {color: #606060}
37 span.s14 {color: #2b7000}
38 span.Apple-tab-span {white-space:pre}
39 </style>
40 </head>
41 <body>
42 <p class="p1"><span class="s1"><b>SCTextField<span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></b></span><b>a text field for entering text</b><span class="s1"><b><span class="Apple-tab-span"> </span></b></span></p>
43 <p class="p2"><br></p>
44 <p class="p1"><b>Inherits from: </b><a href="../../Core/Object.html"><span class="s2"><b>Object</b></span></a><b> : </b><a href="SCView.html"><span class="s2"><b>SCView</b></span></a><b> : </b><a href="SCStaticTextBase.html"><span class="s3"><b>SCStaticTextBase</b></span></a><b> : </b><a href="SCNumberBox.html"><span class="s2"><b>SCNumberBox</b></span></a></p>
45 <p class="p2"><br></p>
46 <p class="p3"><span class="s4"><b>See also:</b> <a href="SCStaticText.html"><span class="s5">SCStaticText</span></a>, <a href="SCTextView.html"><span class="s5">SCTextView</span></a></span></p>
47 <p class="p2"><br></p>
48 <p class="p4"><b>Some Important Issues Regarding SCTextField</b></p>
49 <p class="p2"><br></p>
50 <p class="p1">Does not allow copying and pasting. Does not handle composed character sequences ( etc. ). Use <a href="SCTextView.html"><span class="s2">SCTextView</span></a> for these features. Hit delete before typing to clear the text field. Drag and drop accepts a any <a href="../../Core/Object.html"><span class="s6">Object</span></a> and recieves it <b>asString</b>. Inherits formatting methods from <a href="SCStaticTextBase.html"><span class="s7">SCStaticTextBase</span></a>. If you drag a file from the finder onto an SCTextView, it will display the file path.</p>
51 <p class="p2"><br></p>
52 <p class="p4"><b>Creation / Class Methods</b></p>
53 <p class="p5"><b><span class="Apple-tab-span"> </span>*new (parent, bounds)</b></p>
54 <p class="p6"><b><span class="Apple-tab-span"> </span></b></p>
55 <p class="p7"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>parent </b>- The parent view.</p>
56 <p class="p7"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>bounds </b>- An instance of <a href="../../Geometry/Rect.html"><span class="s8">Rect</span></a>, or a <a href="../../Geometry/Point.html"><span class="s8">Point</span></a> indicating width@height.</p>
57 <p class="p6"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
58 <p class="p5"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="s9">(</span></p>
59 <p class="p8"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>w = <span class="s10">Window</span>.new.front;</p>
60 <p class="p8"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>a = <span class="s10">TextField</span>(w, <span class="s10">Rect</span>(10, 10, 150, 20));</p>
61 <p class="p9"><span class="s4"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>a.string = </span>"some default text"<span class="s4">;</span></p>
62 <p class="p8"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>a.action = {<span class="s10">arg</span> field; field.value.postln; };</p>
63 <p class="p8"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>)</p>
64 <p class="p10"><br></p>
65 <p class="p11"><b>Accessing Instance and Class Variables</b></p>
66 <p class="p6"><span class="Apple-tab-span"> </span></p>
67 <p class="p5"><b><span class="Apple-tab-span"> </span>string_ (s)</b></p>
68 <p class="p6"><b><span class="Apple-tab-span"> </span></b></p>
69 <p class="p5"><b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></b>Sets the <a href="../../Collections/String.html"><span class="s11">String</span></a> of the text field.</p>
70 <p class="p7"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>s </b>- An instance of <a href="../../Collections/String.html"><span class="s11">String</span></a>.</p>
71 <p class="p6"><br></p>
72 <p class="p11"><b>Subclassing and Internal Methods</b></p>
73 <p class="p12"><br></p>
74 <p class="p5"><span class="s12"><span class="Apple-tab-span"> </span></span>The following methods are usually not used directly or are called by a primitive. Programmers can still call or override these as needed.</p>
75 <p class="p6"><span class="Apple-tab-span"> </span></p>
76 <p class="p5"><span class="Apple-tab-span"> </span><b>*viewClass</b></p>
77 <p class="p6"><b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></b></p>
78 <p class="p5"><b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></b>Sets the view class thus determining which primitive is called.</p>
79 <p class="p6"><span class="Apple-tab-span"> </span></p>
80 <p class="p5"><b><span class="Apple-tab-span"> </span>defaultKeyDownAction (char, modifiers, unicode)</b></p>
81 <p class="p6"><b><span class="Apple-tab-span"> </span></b></p>
82 <p class="p5"><b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></b>The default keydown actions are:</p>
83 <p class="p6"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
84 <p class="p5"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>key</b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>action</b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>comment</b></p>
85 <p class="p5"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>\r <span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>valueAction on the string</p>
86 <p class="p5"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>\n, <span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>valueAction on the string<span class="Apple-tab-span"> </span></p>
87 <p class="p5"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>3.asAscii,<span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>valueAction on the string<span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>(enter key or cmd-C on Mac OSX )</p>
88 <p class="p5"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>127.asAscii<span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>clears the <b>keyString</b> (See <a href="SCNumberBox.html"><span class="s3">SCNumberBox</span></a>)<span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>(delete key)</p>
89 <p class="p5"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>if no text has been typed yet. Otherwise</p>
90 <p class="p5"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>deletes the last typed character.</p>
91 <p class="p5"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>all others<span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>adds character to the <b>keyString</b> (See <a href="SCNumberBox.html"><span class="s3">SCNumberBox</span></a>)</p>
92 <p class="p6"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
93 <p class="p5"><b><span class="Apple-tab-span"> </span>defaultGetDrag</b></p>
94 <p class="p6"><b><span class="Apple-tab-span"> </span></b></p>
95 <p class="p5"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>The method called by default when initiating a drag <b>from</b> an SCTextView. Returns <b>string</b>.</p>
96 <p class="p6"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
97 <p class="p5"><span class="Apple-tab-span"> </span><b>defaultCanReceiveDrag</b></p>
98 <p class="p6"><b><span class="Apple-tab-span"> </span></b></p>
99 <p class="p5"><b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></b>The method called by default when attempting to place a drag in this object. By default, SCTextView will respond only to drags containing objects that respond to the method, <b>asString</b> (basically, all objects, since <a href="../../Core/Object.html"><span class="s3">Object</span></a> does).</p>
100 <p class="p6"><br></p>
101 <p class="p5"><span class="Apple-tab-span"> </span><b>defaultReceiveDrag</b></p>
102 <p class="p6"><b><span class="Apple-tab-span"> </span></b></p>
103 <p class="p5"><b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></b>The default method called when a drag has been recieved. Performs <b>valueAction_()</b> using <b>currentDrag</b> as an argument.</p>
104 <p class="p10"><br></p>
105 <p class="p11"><b>Examples</b></p>
106 <p class="p13"><br></p>
107 <p class="p8">(</p>
108 <p class="p8">w = <span class="s10">Window</span>.new.front;</p>
109 <p class="p8">a = <span class="s10">TextField</span>(w, <span class="s10">Rect</span>(10, 10, 150, 20));</p>
110 <p class="p8">a.string = <span class="s13">"hi there"</span>;</p>
111 <p class="p8">a.action = {<span class="s10">arg</span> field; field.value.postln; };</p>
112 <p class="p8">)</p>
113 <p class="p13"><br></p>
114 <p class="p14">// does not do the action</p>
115 <p class="p8">a.value = <span class="s13">"yo"</span>;</p>
116 <p class="p8">a.string = <span class="s13">"oy"</span>;</p>
117 <p class="p13"><br></p>
118 <p class="p14"><span class="s4">a.valueAction_(</span><span class="s13">"this is not a pipe"</span><span class="s4">); </span>//does the action, if the value has changed</p>
119 <p class="p14"><span class="s4">a.doAction; </span>//evaluates the action with the content of the text field as an argument</p>
120 <p class="p13"><br></p>
121 <p class="p8">a.background_(<span class="s10">Color</span>.grey);</p>
122 <p class="p8">a.stringColor_(<span class="s10">Color</span>.white);</p>
123 <p class="p8">a.align_(<span class="s14">\center</span>);</p>
124 <p class="p13"><br></p>
125 </body>
126 </html>