Removing an old, cherished, yet pointless caveat "This documentation is
[supercollider.git] / Help / GUI / Cocoa-GUI / SCView.html
blob26c58fd2da55e0369be983afad3207b413b47644
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.54">
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: 9.0px Monaco; min-height: 12.0px}
13 p.p4 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; color: #0000bf}
14 p.p5 {margin: 0.0px 0.0px 0.0px 57.0px; text-indent: -57.0px; font: 9.0px Monaco; min-height: 12.0px}
15 p.p6 {margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Helvetica}
16 p.p7 {margin: 0.0px 0.0px 0.0px 57.0px; text-indent: -57.0px; font: 12.0px Helvetica}
17 p.p8 {margin: 0.0px 0.0px 0.0px 57.0px; text-indent: -57.0px; font: 12.0px Helvetica; min-height: 14.0px}
18 p.p9 {margin: 0.0px 0.0px 0.0px 85.0px; text-indent: -85.0px; font: 12.0px Helvetica}
19 p.p10 {margin: 0.0px 0.0px 0.0px 57.0px; text-indent: -57.0px; font: 14.0px Helvetica}
20 p.p11 {margin: 0.0px 0.0px 0.0px 57.0px; text-indent: -57.0px; font: 14.0px Helvetica; min-height: 17.0px}
21 p.p12 {margin: 0.0px 0.0px 0.0px 85.0px; text-indent: -85.0px; font: 12.0px Helvetica; min-height: 14.0px}
22 p.p13 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco}
23 p.p14 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color: #bf0000}
24 p.p15 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color: #606060}
25 p.p16 {margin: 0.0px 0.0px 0.0px 57.0px; text-indent: -57.0px; font: 9.0px Monaco}
26 p.p17 {margin: 0.0px 0.0px 0.0px 57.0px; text-indent: -57.0px; font: 9.0px Monaco; color: #0000bf}
27 p.p18 {margin: 0.0px 0.0px 0.0px 57.0px; text-indent: -57.0px; font: 9.0px Monaco; color: #bf0000}
28 p.p19 {margin: 0.0px 0.0px 0.0px 57.0px; text-indent: -57.0px; font: 9.0px Monaco; color: #007300}
29 span.s1 {font: 18.0px Helvetica}
30 span.s2 {color: #0000bf}
31 span.s3 {color: #000000}
32 span.s4 {font: 14.0px Helvetica}
33 span.s5 {font: 9.0px Monaco}
34 span.s6 {color: #606060}
35 span.s7 {color: #007300}
36 span.s8 {font: 12.0px Helvetica; color: #000000}
37 span.s9 {font: 12.0px Helvetica}
38 span.Apple-tab-span {white-space:pre}
39 </style>
40 </head>
41 <body>
42 <p class="p1"><span class="s1"><b>SCView<span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></b></span><b>the abstract superclass for all SC GUI widgets</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></p>
45 <p class="p3"><br></p>
46 <p class="p1">SCView is the abstract superclass for all SC GUI widgets. You cannot call SCView directly. Several key methods and variables are defined in SCView and inherited in its subclasses. This help file contains important information about many of the basic functions of all gui views, in particular defining actions, defining drag and drop, defining mouse actions, and defining key actions.</p>
47 <p class="p2"><br></p>
48 <p class="p4"><span class="s3"><b>See also:</b> <a href="SCWindow.html">SCWindow</a></span>, <a href="../GUI-Tools/GUI.html">GUI</a></p>
49 <p class="p5"><br></p>
50 <p class="p6"><b>Some Important Issues Regarding SCView</b></p>
51 <p class="p2"><br></p>
52 <p class="p1">If you try to set parameters of a GUI widget from a<span class="Apple-converted-space">  </span>Routine , which uses the <a href="../../Scheduling/SystemClock.html"><span class="s2">SystemClock</span></a> by default, you must wrap it in a deferred function: { myView.value_(2) }.defer .<span class="Apple-converted-space">  </span>You do not need to use .defer, if you use the <a href="../../Scheduling/AppClock.html"><span class="s2">AppClock</span></a>.</p>
53 <p class="p5"><br></p>
54 <p class="p6"><b>Creation / Class Methods</b></p>
55 <p class="p5"><br></p>
56 <p class="p7"><b><span class="Apple-tab-span"> </span>*new (parent, bounds)</b></p>
57 <p class="p8"><b><span class="Apple-tab-span"> </span></b></p>
58 <p class="p9"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>parent </b>- The parent view.</p>
59 <p class="p9"><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="s2">Rect</span></a>, or a <a href="../../Geometry/Point.html"><span class="s2">Point</span></a> indicating width@height.</p>
60 <p class="p5"><br></p>
61 <p class="p10"><b>Accessing Instance and Class Variables</b></p>
62 <p class="p11"><br></p>
63 <p class="p7"><b><span class="Apple-tab-span"> </span>parent</b></p>
64 <p class="p8"><b><span class="Apple-tab-span"> </span></b><span class="Apple-tab-span"> </span></p>
65 <p class="p7"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>Returns the view's parent view, or nil if the view is a top view.</p>
66 <p class="p11"><b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></b></p>
67 <p class="p7"><b><span class="Apple-tab-span"> </span>bounds</b></p>
68 <p class="p7"><b><span class="Apple-tab-span"> </span>bounds_ (rect)</b></p>
69 <p class="p8"><b><span class="Apple-tab-span"> </span></b></p>
70 <p class="p7"><b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></b>A <a href="../../Geometry/Rect.html"><span class="s2">Rect</span></a> determining the bounds of the View. Some containers, such as <a href="SCHLayoutView.html"><span class="s2">SCHLayoutView</span></a> and <a href="SCVLayoutView.html"><span class="s2">SCVLayoutView</span></a>, will use only the width and height of a child view's <b>bounds</b>.</p>
71 <p class="p9"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>rect </b>- an instance of <a href="../../Geometry/Rect.html"><span class="s2">Rect</span></a>, or a <a href="../../Geometry/Point.html"><span class="s2">Point</span></a> indicating width@height.</p>
72 <p class="p8"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
73 <p class="p7"><b><span class="Apple-tab-span"> </span>absoluteBounds</b></p>
74 <p class="p8"><b><span class="Apple-tab-span"> </span></b></p>
75 <p class="p7"><b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></b>Returns a <a href="../../Geometry/Rect.html"><span class="s2">Rect</span></a> witht he absolute bounds of the view.</p>
76 <p class="p8"><span class="s4"><b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></b></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></p>
77 <p class="p7"><b><span class="Apple-tab-span"> </span>refresh</b></p>
78 <p class="p8"><b><span class="Apple-tab-span"> </span></b></p>
79 <p class="p7"><b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></b>Refreshes the view.</p>
80 <p class="p8"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
81 <p class="p7"><b><span class="Apple-tab-span"> </span>remove</b></p>
82 <p class="p8"><b><span class="Apple-tab-span"> </span></b></p>
83 <p class="p7"><b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></b>Removes the view from its <b>parent</b> view and closes the view.</p>
84 <p class="p8"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
85 <p class="p7"><b><span class="Apple-tab-span"> </span>enabled</b></p>
86 <p class="p7"><b><span class="Apple-tab-span"> </span>enabled_ (bool)</b></p>
87 <p class="p8"><b><span class="Apple-tab-span"> </span></b></p>
88 <p class="p7"><b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></b>Gets / sets whether the view is enabled, ie. responds to key or mouse actions (see below). Defaults to false, but views which respond to user input default to true. Some views will be greyed if they are disabled.</p>
89 <p class="p7"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>bool </b>- An instance of <a href="../../Core/Boolean.html"><span class="s2">Boolean</span></a>.</p>
90 <p class="p5"><br></p>
91 <p class="p7"><b><span class="Apple-tab-span"> </span>canFocus</b></p>
92 <p class="p7"><b><span class="Apple-tab-span"> </span>canFocus_ (bool)</b></p>
93 <p class="p8"><b><span class="Apple-tab-span"> </span></b></p>
94 <p class="p7"><b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></b>Gets / sets whether the view can be focussed. Defualts to true.</p>
95 <p class="p9"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>bool </b>- An instance of <a href="../../Core/Boolean.html"><span class="s2">Boolean</span></a>.</p>
96 <p class="p5"><br></p>
97 <p class="p7"><span class="s5"><span class="Apple-tab-span"> </span></span><b>hasFocus</b></p>
98 <p class="p7"><b><span class="Apple-tab-span"> </span>focus (flag)</b></p>
99 <p class="p8"><b><span class="Apple-tab-span"> </span></b></p>
100 <p class="p7"><b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></b>Gets / sets whether the view is focussed.</p>
101 <p class="p9"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>flag </b>- An instance of <a href="../../Core/Boolean.html"><span class="s2">Boolean</span></a>.</p>
102 <p class="p12"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
103 <p class="p7"><b><span class="Apple-tab-span"> </span>isClosed</b></p>
104 <p class="p7"><b><span class="Apple-tab-span"> </span>notClosed</b></p>
105 <p class="p8"><b><span class="Apple-tab-span"> </span></b></p>
106 <p class="p7"><b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></b>Returns an instance of <a href="../../Core/Boolean.html"><span class="s2">Boolean</span></a> depending on whether the view is closed or not.</p>
107 <p class="p8"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
108 <p class="p7"><b><span class="Apple-tab-span"> </span>onClose_(arg1)</b></p>
109 <p class="p7"><b><span class="Apple-tab-span"> </span>onClose</b></p>
110 <p class="p8"><b><span class="Apple-tab-span"> </span></b><span class="Apple-tab-span"> </span></p>
111 <p class="p7"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>A function to be evaluated upon closing the view.</p>
112 <p class="p9"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>arg1 </b>- A <a href="../../Core/Kernel/Function.html"><span class="s2">Function</span></a> or <a href="../../Core/Kernel/FunctionList.html"><span class="s2">FunctionList</span></a>. Default value is nil.</p>
113 <p class="p8"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
114 <p class="p10"><b>Customizing Appearance</b></p>
115 <p class="p5"><br></p>
116 <p class="p7"><b><span class="Apple-tab-span"> </span>background</b></p>
117 <p class="p7"><b><span class="Apple-tab-span"> </span>background_ (color)</b></p>
118 <p class="p8"><b><span class="Apple-tab-span"> </span></b></p>
119 <p class="p7"><b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></b>The background color of the view.</p>
120 <p class="p9"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>color </b>- An instance of <a href="../GUI-Tools/Color.html"><span class="s2">Color</span></a>.</p>
121 <p class="p12"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
122 <p class="p7"><b><span class="Apple-tab-span"> </span>focusColor</b></p>
123 <p class="p7"><b><span class="Apple-tab-span"> </span>focusColor_ (color)</b></p>
124 <p class="p8"><b><span class="Apple-tab-span"> </span></b></p>
125 <p class="p7"><b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></b>The background color of the view when it is focussed.</p>
126 <p class="p9"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>color </b>- An instance of <a href="../GUI-Tools/Color.html"><span class="s2">Color</span></a>.</p>
127 <p class="p5"><br></p>
128 <p class="p7"><b><span class="Apple-tab-span"> </span>visible</b></p>
129 <p class="p7"><b><span class="Apple-tab-span"> </span>visible_ (bool)</b></p>
130 <p class="p8"><b><span class="Apple-tab-span"> </span></b></p>
131 <p class="p7"><b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></b>Gets / sets whether the view is visible. Defualts to true.</p>
132 <p class="p9"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>bool </b>- An instance of <a href="../../Core/Boolean.html"><span class="s2">Boolean</span></a>.</p>
133 <p class="p12"><br></p>
134 <p class="p12"><br></p>
135 <p class="p10"><b>Resize Constraints</b></p>
136 <p class="p11"><br></p>
137 <p class="p1"><b>resize</b> takes integers 1-9 as an argument which defines how a view behaves when a window is resized.</p>
138 <p class="p1">See <a href="../GUI-Tools/resize.html"><span class="s2">resize</span></a> for details and examples.</p>
139 <p class="p12"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
140 <p class="p5"><br></p>
141 <p class="p10"><b>Defining Actions</b></p>
142 <p class="p5"><br></p>
143 <p class="p1">Actions are Functions which are evaluated when the primitive calls <b>doAction</b> in response to user input of some sort. Typically a view like <a href="SCButton.html"><span class="s2">SCButton</span></a>, <a href="SCSlider.html"><span class="s2">SCSlider</span></a>, <a href="SCPopUpMenu.html"><span class="s2">SCPopUpMenu</span></a>, etc, use <b>action</b> to store the function to be performed on user input. Many views only call <b>doAction</b> if their value has changed.</p>
144 <p class="p5"><br></p>
145 <p class="p7"><b><span class="Apple-tab-span"> </span>action</b></p>
146 <p class="p7"><b><span class="Apple-tab-span"> </span>action_(arg1)</b></p>
147 <p class="p8"><b><span class="Apple-tab-span"> </span></b></p>
148 <p class="p7"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>The action a view takes if doAction is called (normally by the primitive). See <b>doAction</b>. Many view subclasses override this methods for their own purposes.</p>
149 <p class="p9"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>arg1 </b>- An instance of <a href="../../Core/Kernel/Function.html"><span class="s2">Function</span></a> or <a href="../../Core/Kernel/FunctionList.html"><span class="s2">FunctionList</span></a>. Default value is nil.</p>
150 <p class="p12"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
151 <p class="p7"><b><span class="Apple-tab-span"> </span>addAction (func, selector)</b></p>
152 <p class="p7"><b><span class="Apple-tab-span"> </span>removeAction (func, selector)</b></p>
153 <p class="p8"><b><span class="Apple-tab-span"> </span></b></p>
154 <p class="p7"><b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></b>Adds/removes an action to or from the list of functions in the variable determined by <b>selector</b>. Adding functionality to a view by the method <b>addAction</b> is useful for adding things to existing frameworks that have action functions already.</p>
155 <p class="p7"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>func </b>- An instance of <a href="../../Core/Kernel/Function.html"><span class="s2">Function</span></a>.</p>
156 <p class="p9"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>selector </b>- A <a href="../../Core/Symbol.html"><span class="s2">Symbol</span></a>. Defaults to<b> \action</b>. By default, <b>addAction</b> will add a function to the <a href="../../Core/Kernel/FunctionList.html"><span class="s2">FunctionList</span></a> of <b>action</b>, but you can also make it add a function to any other (sensible) instance or class variable in SCView by using a different selector, for example, \<b>globalKeyDownAction</b> or \<b>mouseUpAction</b> or \<b>onClose</b> . See the other action variables below.</p>
157 <p class="p3"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
158 <p class="p13"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>(</p>
159 <p class="p13"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>w = <span class="s2">Window</span>.new(<span class="s6">"A Slider"</span>);</p>
160 <p class="p13"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>a = <span class="s2">Slider</span>.new(w, <span class="s2">Rect</span>(40, 10, 300, 30));</p>
161 <p class="p13"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>w.front</p>
162 <p class="p13"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>);</p>
163 <p class="p3"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
164 <p class="p14"><span class="s3"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></span>// adding and removing an action:</p>
165 <p class="p15"><span class="s3"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>f = { </span><span class="s2">|sl|</span><span class="s3"> </span>"--------*******-------"<span class="s3">.postln; };</span></p>
166 <p class="p13"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>a.addAction(f);</p>
167 <p class="p13"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>a.removeAction(f);</p>
168 <p class="p8"><br></p>
169 <p class="p10"><b>Defining Key Actions</b></p>
170 <p class="p11"><br></p>
171 <p class="p1">Use the methods below to store functions to be called in response to a key event initiated by the user. If you return nil from your function, or you have no function registered, the event will bubble up to the parent view which may then respond. It will continue to bubble up unless something responds or it hits the topView of the window. You may register a function in the window's topView to respond to all unhandled events for the window.</p>
172 <p class="p2"><br></p>
173 <p class="p1">When calling one of the key actions , the function will be passed the following arguments (in order):</p>
174 <p class="p2"><br></p>
175 <p class="p9"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>view</b> - The receiving instance of SCView.</p>
176 <p class="p12"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
177 <p class="p9"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>char</b> - The character pressed, possibly unprintable. Character sequences (for example ) get passed as two characters, the first one blank ( ), the second one is the unmodified character (e). This will also vary depending on the nationality the keyboard is set to.</p>
178 <p class="p12"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
179 <p class="p9"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>modifiers</b>- An integer bit field indicating the modifier keys in effect. You can examine individual flag settings using the C bitwise AND operator. For a list of these, see <a href="../GUI-Tools/modifiers.html"><span class="s2">modifiers</span></a>.</p>
180 <p class="p12"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
181 <p class="p9"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>unicode</b> - The unicode integer.</p>
182 <p class="p12"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
183 <p class="p9"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>keycode</b> - The hardware dependent keycode indicating the physical key. This will vary from machine to machine, but is useful for building musical interfaces using the computer keyboard.</p>
184 <p class="p12"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
185 <p class="p9"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>N.B.: Function key modifier may change the keycode.</p>
186 <p class="p12"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
187 <p class="p9"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>For various reasons these don't make it through cocoa:</p>
188 <p class="p9"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>most command modifiers</p>
189 <p class="p9"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>ctl-tab</p>
190 <p class="p9"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>ctl-escape</p>
191 <p class="p9"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>tab and shift tab are currently trapped by SC itself for cycling the focus through the views.</p>
192 <p class="p5"><br></p>
193 <p class="p7"><b><span class="Apple-tab-span"> </span>keyUpAction</b></p>
194 <p class="p7"><b><span class="Apple-tab-span"> </span>keyDownAction</b></p>
195 <p class="p7"><b><span class="Apple-tab-span"> </span>keyUpAction_(arg1)</b></p>
196 <p class="p7"><b><span class="Apple-tab-span"> </span>keyDownAction_(arg1)</b></p>
197 <p class="p8"><b><span class="Apple-tab-span"> </span></b></p>
198 <p class="p7"><b><span class="Apple-tab-span"> </span></b><span class="Apple-tab-span"> </span>This is where you define your key actions. If these variables are nil (the default), <b>defaultKeyDownAction</b> or <b>defaultKeyUpAction</b> are called instead. Many subclasses define their own appropriate default key actions. See also <b>addAction (func, selector)</b> above.</p>
199 <p class="p9"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>arg1 </b>- An instance of <a href="../../Core/Kernel/Function.html"><span class="s2">Function</span></a> or <a href="../../Core/Kernel/FunctionList.html"><span class="s2">FunctionList</span></a>. The function is passed the following argument list: <b>view</b>, <b>char</b>, <b>modifiers</b>, <b>unicode</b>, <b>keycode</b>.</p>
200 <p class="p12"><br></p>
201 <p class="p7"><b><span class="Apple-tab-span"> </span>globalKeyDownAction</b><span class="Apple-tab-span"> </span></p>
202 <p class="p7"><span class="Apple-tab-span"> </span><b>globalKeyDownAction_(arg1)</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></p>
203 <p class="p7"><b><span class="Apple-tab-span"> </span>globalKeyUpAction</b></p>
204 <p class="p7"><b><span class="Apple-tab-span"> </span>globalKeyUpAction_(arg1)</b></p>
205 <p class="p8"><b><span class="Apple-tab-span"> </span></b></p>
206 <p class="p7"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>A class variable. Here you can define a global key action. An instance of <a href="../../Core/Kernel/Function.html"><span class="s2">Function</span></a> or <a href="../../Core/Kernel/FunctionList.html"><span class="s2">FunctionList</span></a> which is globally evaluated on a key action. See also <b>addAction (func, selector)</b> above.</p>
207 <p class="p7"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>arg1 </b>- An instance of <a href="../../Core/Kernel/Function.html"><span class="s2">Function</span></a> or <a href="../../Core/Kernel/FunctionList.html"><span class="s2">FunctionList</span></a>. The function is passed the following argument list: <b>view</b>, <b>char</b>, <b>modifiers</b>, <b>unicode</b>, <b>keycode</b>.</p>
208 <p class="p8"><br></p>
209 <p class="p12"><br></p>
210 <p class="p7"><b><span class="Apple-tab-span"> </span>keyModifiersChangedAction_(arg1)</b></p>
211 <p class="p7"><b><span class="Apple-tab-span"> </span>keyModifiersChangedAction</b></p>
212 <p class="p8"><b><span class="Apple-tab-span"> </span></b></p>
213 <p class="p7"><b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></b>This is where you set actions to be performed if the modifier changes. See also <b>addAction (func, selector)</b> above.</p>
214 <p class="p9"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>arg1 </b>- An instance of Function or FunctionList. The function is passed the following argument list: <b>view, modifiers</b>.</p>
215 <p class="p12"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
216 <p class="p10"><b>Defining Mouse Actions</b></p>
217 <p class="p11"><br></p>
218 <p class="p1">Use the methods below to store functions to be called in response to a mouse action initiated by the user. A view must be <b>enabled</b> for the mouse actions to work. The function is passed one or more arguments from the following argument list (in order):</p>
219 <p class="p2"><br></p>
220 <p class="p9"><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>view</b> - the view</p>
221 <p class="p9"><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>x</b> - the x coordinate</p>
222 <p class="p9"><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>y</b> - the y coordinate</p>
223 <p class="p9"><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>modifiers</b> - a modifier key number. For a list of these, see <a href="../GUI-Tools/modifiers.html"><span class="s2">modifiers</span></a>.</p>
224 <p class="p9"><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>buttonNumber</b> - 0-left, 1-right, 2-middle, etc.</p>
225 <p class="p9"><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>clickCount</b> - the number of clicks within the system click time limit. At least 1.</p>
226 <p class="p12"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
227 <p class="p7"><b><span class="Apple-tab-span"> </span>mouseDownAction</b></p>
228 <p class="p7"><b><span class="Apple-tab-span"> </span>mouseDownAction_(arg1)</b></p>
229 <p class="p8"><b><span class="Apple-tab-span"> </span></b></p>
230 <p class="p7"><b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></b>This is where you set your mouse down actions. See also <b>addAction (func, selector)</b> above.</p>
231 <p class="p9"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>arg1 </b>- An instance of <a href="../../Core/Kernel/Function.html"><span class="s2">Function</span></a> or <a href="../../Core/Kernel/FunctionList.html"><span class="s2">FunctionList</span></a>. The function is passed the following argument list <b>view, x, y, modifiers, buttonNumber, clickCount.</b></p>
232 <p class="p12"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
233 <p class="p7"><b><span class="Apple-tab-span"> </span>mouseUpAction</b></p>
234 <p class="p7"><b><span class="Apple-tab-span"> </span>mouseUpAction_(arg1)</b></p>
235 <p class="p8"><b><span class="Apple-tab-span"> </span></b></p>
236 <p class="p7"><b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></b>This is where you set your mouse up actions. See also <b>addAction (func, selector)</b> above.</p>
237 <p class="p9"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>arg1 </b>- An instance of <a href="../../Core/Kernel/Function.html"><span class="s2">Function</span></a> or <a href="../../Core/Kernel/FunctionList.html"><span class="s2">FunctionList</span></a>. This is where you set your mouse actions. The function is passed the following argument list: <b>view</b>, <b>x</b>, <b>y</b>, <b>modifiers</b>. Default is nil.</p>
238 <p class="p12"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
239 <p class="p7"><b><span class="Apple-tab-span"> </span>mouseMoveAction</b></p>
240 <p class="p7"><b><span class="Apple-tab-span"> </span>mouseMoveAction_(arg1)</b></p>
241 <p class="p8"><b><span class="Apple-tab-span"> </span></b></p>
242 <p class="p7"><b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></b>This is where you set your mouse move actions. See also <b>addAction (func, selector)</b> above.</p>
243 <p class="p9"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>arg1 </b>- An instance of <a href="../../Core/Kernel/Function.html"><span class="s2">Function</span></a> or <a href="../../Core/Kernel/FunctionList.html"><span class="s2">FunctionList</span></a>. This is where you set your mouse actions. The function is passed the following argument list: <b>view</b>, <b>x</b>, <b>y</b>, <b>modifiers</b>. Default is nil.</p>
244 <p class="p5"><br></p>
245 <p class="p7"><b><span class="Apple-tab-span"> </span>mouseOverAction</b></p>
246 <p class="p7"><b><span class="Apple-tab-span"> </span>mouseOverAction_(arg1)</b></p>
247 <p class="p8"><b><span class="Apple-tab-span"> </span></b></p>
248 <p class="p7"><b><span class="Apple-tab-span"> </span></b><span class="Apple-tab-span"> </span>This is where you set your mouse over actions. For this to work, <b>acceptsMouseOver</b> of the parent Window must be set to true. See also <b>addAction (func, selector)</b> above.</p>
249 <p class="p9"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>arg1 </b>- An instance of <a href="../../Core/Kernel/Function.html"><span class="s2">Function</span></a> or <a href="../../Core/Kernel/FunctionList.html"><span class="s2">FunctionList</span></a>. The function is passed the following argument list: <b>view</b>, <b>x</b>, <b>y</b>. Default is nil.</p>
250 <p class="p5"><br></p>
251 <p class="p13"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>(</p>
252 <p class="p13"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>w=<span class="s2">SCWindow</span>.new.front;</p>
253 <p class="p3"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
254 <p class="p13"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>v=<span class="s2">SCCompositeView</span>.new(w,w.view.bounds.insetBy(10)).background_(<span class="s2">Color</span>.rand);</p>
255 <p class="p13"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>v.decorator=<span class="s2">FlowLayout</span>(v.bounds);</p>
256 <p class="p13"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>t=<span class="s2">Array</span>.fill(9,{<span class="s2">arg</span> i; <span class="s2">var</span> n,r,q;</p>
257 <p class="p13"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>n=<span class="s2">SCCompositeView</span>.new(v,<span class="s2">Rect</span>(20,20,121,121)).background_(<span class="s2">Color</span>.rand);</p>
258 <p class="p13"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>q=<span class="s2">SCStaticText</span>(n, n.bounds.moveTo(0,0).insetBy(25)).string_((70+i).asAscii).align_(<span class="s7">\center</span>);</p>
259 <p class="p13"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>q.enabled=<span class="s2">true</span>;</p>
260 <p class="p13"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>q.font=<span class="s2">Font</span>.default.copy;</p>
261 <p class="p13"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>q.background_(<span class="s2">Color</span>.rand);</p>
262 <p class="p13"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>q.mouseDownAction={</p>
263 <p class="p13"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>n.background_(<span class="s2">Color</span>.rand);</p>
264 <p class="p13"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>q.font=q.font.size_(5+q.font.size+7%60)</p>
265 <p class="p13"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>};</p>
266 <p class="p3"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
267 <p class="p3"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
268 <p class="p13"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>});</p>
269 <p class="p13"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>)</p>
270 <p class="p3"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
271 <p class="p10"><b>Defining Drag and Drop Actions</b></p>
272 <p class="p11"><br></p>
273 <p class="p1">Each view subclass has a default object that it exports when dragged from. For sliders its the value of the slider, for lists it is the currently selected numeric index etc. By setting the <b>beginDragAction</b> handler you can return a different object based on the context and your application.</p>
274 <p class="p2"><br></p>
275 <p class="p1">The current dragged object can be found in the classvar SCView.<b>currentDrag</b>. Files dragged from the Finder will result in an Array of Strings representing the files' paths. Objects dragged from within SuperCollider are also in SCView.<b>currentDragString</b> as a compile string. Text dragged from other applications is in SCView.<b>currentDragString</b> and the results of attempting to compile that as sc code is in SCView.<b>currentDrag.</b></p>
276 <p class="p2"><br></p>
277 <p class="p1">Each view subclass has a <b>defaultCanReceiveDrag</b> method that determines if the current object being dragged is possible for this view to accept, and a <b>defaultReceiveDrag</b> method for actually receiving the drag. Sliders accept numbers, simple text labels do not accept drags etc. After receiving the drag, the SCView.<b>currentDrag</b> is set to nil. Containers typically cannot receive drags by default.</p>
278 <p class="p2"><br></p>
279 <p class="p1">By setting the <b>canReceiveDragHandler</b> and <b>receiveDragHandler</b> you can make a view accept and receive objects based on the context and your application. (Note: currently not possible for <a href="SCStaticText.html"><span class="s2">SCStaticText</span></a>)</p>
280 <p class="p8"><br></p>
281 <p class="p7"><b><span class="Apple-tab-span"> </span>beginDragAction_(arg1)</b></p>
282 <p class="p7"><b><span class="Apple-tab-span"> </span>beginDragAction</b></p>
283 <p class="p8"><b><span class="Apple-tab-span"> </span></b><span class="Apple-tab-span"> </span></p>
284 <p class="p7"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>This is a custom handler determining the content of the drag. If this variable is nil (the default), <b>defaultGetDrag</b> is called instead. Many views already have their own appropriate <b>defaultGetDrag. </b>See also <b>addAction (func, selector)</b> above.</p>
285 <p class="p9"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>arg1 </b>- An instance of <a href="../../Core/Kernel/Function.html"><span class="s2">Function</span></a> or <a href="../../Core/Kernel/FunctionList.html"><span class="s2">FunctionList</span></a>. The function is passed the following argument list: <b>view</b>, <b>x, y</b>.</p>
286 <p class="p8"><br></p>
287 <p class="p7"><b><span class="Apple-tab-span"> </span>canReceiveDragHandler_(arg1)</b></p>
288 <p class="p7"><b><span class="Apple-tab-span"> </span>canReceiveDragHandler</b></p>
289 <p class="p8"><b><span class="Apple-tab-span"> </span></b></p>
290 <p class="p7"><b><span class="Apple-tab-span"> </span></b><span class="Apple-tab-span"> </span>This is where you deterimine under which conditions a view will recieve a drag. If this variable is nil (the default), <b>defaultCanReceiveDrag</b> is called instead. See also <b>addAction (func, selector)</b> above.</p>
291 <p class="p9"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>arg1 </b>- An instance of <a href="../../Core/Kernel/Function.html"><span class="s2">Function</span></a> or <a href="../../Core/Kernel/FunctionList.html"><span class="s2">FunctionList</span></a>. This function typically will examine <b>currentDrag,</b> an return a boolean. The function is passed the following argument list: <b>view</b>, <b>x, y</b>.</p>
292 <p class="p8"><br></p>
293 <p class="p7"><b><span class="Apple-tab-span"> </span>receiveDragHandler_(arg1)</b></p>
294 <p class="p7"><b><span class="Apple-tab-span"> </span>receiveDragHandler</b></p>
295 <p class="p8"><b><span class="Apple-tab-span"> </span></b><span class="Apple-tab-span"> </span></p>
296 <p class="p7"><b><span class="Apple-tab-span"> </span></b><span class="Apple-tab-span"> </span>This is where you deterimine what a view will do when it receives a drag. If this variable is nil (the default), <b>defaultReceiveDrag</b> is called instead. See also <b>addAction (func, selector)</b> above.</p>
297 <p class="p9"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>arg1 </b>- An instance of <a href="../../Core/Kernel/Function.html"><span class="s2">Function</span></a> or <a href="../../Core/Kernel/FunctionList.html"><span class="s2">FunctionList</span></a>. The function is passed the following argument list: <b>view</b>, <b>x, y</b>. Typically it will then precess <b>currentDrag </b>in some way<b>.</b></p>
298 <p class="p8"><b><span class="Apple-tab-span"> </span></b></p>
299 <p class="p7"><b><span class="Apple-tab-span"> </span>dragLabel_(string)</b></p>
300 <p class="p8"><b><span class="Apple-tab-span"> </span></b></p>
301 <p class="p7"><b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></b>Set a <b>string</b> to be displayed in a label while dragging, instead of displaying the object type.</p>
302 <p class="p9"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>string </b>- An instance of <a href="../../Collections/String.html"><span class="s2">String</span></a>.</p>
303 <p class="p12"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
304 <p class="p16"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>(</p>
305 <p class="p16"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>w = <span class="s2">SCWindow</span>.new.front;</p>
306 <p class="p16"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>a = <span class="s2">SCButton</span>(w, <span class="s2">Rect</span>(10, 10, 200, 20)).states_([[<span class="s6">"Hi There!"</span>]]);</p>
307 <p class="p16"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>a.receiveDragHandler = { a.string = <span class="s2">SCView</span>.currentDrag.postln[0].basename};</p>
308 <p class="p16"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>a.beginDragAction = { a.dragLabel =<span class="s6">"I'm dragging: \""</span>++ a.states[0][0]++<span class="s6">"\""</span>; a.states[0][0] };</p>
309 <p class="p16"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="s2">SCDragSink</span>(w,<span class="s2">Rect</span>(10,40,200,20)).align_(<span class="s7">\center</span>).string=<span class="s6">"Cmd-drag from Button to here"</span>;</p>
310 <p class="p16"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>)</p>
311 <p class="p8"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
312 <p class="p7"><b><span class="Apple-tab-span"> </span>currentDrag</b></p>
313 <p class="p8"><b><span class="Apple-tab-span"> </span></b><span class="Apple-tab-span"> </span></p>
314 <p class="p7"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>A class variable. Contains the content fo the current drag. It is set by <b>beginDrag</b>.</p>
315 <p class="p8"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
316 <p class="p7"><b><span class="Apple-tab-span"> </span>currentDragString</b></p>
317 <p class="p8"><b><span class="Apple-tab-span"> </span></b><span class="Apple-tab-span"> </span></p>
318 <p class="p7"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>A class variable. Conatains the content fo the current drag <b>asCompileString</b> (see <a href="../../Core/Object.html"><span class="s2">Object</span></a>). It is set by <b>beginDrag.</b></p>
319 <p class="p8"><br></p>
320 <p class="p10"><b>Subclassing and Internal Methods</b></p>
321 <p class="p11"><br></p>
322 <p class="p1">The following methods are usually not used directly or are called by a primitive. Programmers can still call or override these as needed. For a Tutorial on how to subclass and <a href="SCUserView.html"><span class="s2">SCUserView</span></a> to make your own custom GUI Widgets, see <a href="SCUserViewSubclassing/SCUserView-Subclassing.html"><span class="s2">SCUserView-Subclassing</span></a><span class="s2">. </span>The tutorial is a good template for any View subclass, and clearly explains the most important method overrides.</p>
323 <p class="p2"><span class="Apple-tab-span"> </span></p>
324 <p class="p1">If you want to subclass a GUI class, then it is important to understand the viewClass mechanism (see below). You must set the viewCass if you want to use the primitive of the parent class.</p>
325 <p class="p11"><br></p>
326 <p class="p7"><b><span class="Apple-tab-span"> </span>*viewClass</b></p>
327 <p class="p8"><b><span class="Apple-tab-span"> </span></b></p>
328 <p class="p7"><b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></b>Returns the current GUI class. This class method provides a mechanism to subclass existing GUI objects while still calling their primitives. It is used by many extensions and <a href="../../Extending and Customizing SC/Quarks/Quarks.html"><span class="s2">Quarks</span></a>. E.g., if I subclass <a href="SCNumberBox.html"><span class="s2">SCNumberBox</span></a> with SCMySubClass, but want to continue to use SCNumberbox's primitive, then I have to define tha class method, <b>viewClass</b>, making it return SCNumberBox instead of SCMySubClass, like this:</p>
329 <p class="p8"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
330 <p class="p17"><span class="s8"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></span>SCMySubClass<span class="s3"> : </span>SCNumberBox<span class="s3"> {</span></p>
331 <p class="p5"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
332 <p class="p18"><span class="s3"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>*viewClass{^</span><span class="s2">SCNumberBox</span><span class="s3">} </span>// this ensures that SCNumberBox' primitive is called</p>
333 <p class="p5"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
334 <p class="p18"><span class="s3"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></span>// my other methods ......</p>
335 <p class="p5"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
336 <p class="p16"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>}</p>
337 <p class="p8"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
338 <p class="p7"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>This is because view init methods typically contain this:</p>
339 <p class="p8"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
340 <p class="p16"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="s2">this</span>.prInit(parent.asView, argBounds.asRect,<span class="s2">this</span>.class.viewClass)</p>
341 <p class="p5"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
342 <p class="p7"><b><span class="Apple-tab-span"> </span>*paletteExample (parent, bounds)</b></p>
343 <p class="p8"><b><span class="Apple-tab-span"> </span></b></p>
344 <p class="p7"><b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></b>Normally not used directly. Used by the SCInterfaceBuilder and determines if and how this class is implemented when dragged to the construction view. You can use cmd-shift-N to evoke the interface builder. All views on the Pallette override this with their own appropriate method. Override this to determine how your subclass is displayed in the interface builder.</p>
345 <p class="p8"><br></p>
346 <p class="p7"><b><span class="Apple-tab-span"> </span>init (argParent, argBounds)</b></p>
347 <p class="p8"><b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></b></p>
348 <p class="p7"><b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></b>Creates the view and adds it to its parent.</p>
349 <p class="p9"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>argParent </b>- An SCView or SCWindow SCTopView</p>
350 <p class="p9"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>argBounds </b>- an instance of <a href="../../Geometry/Rect.html"><span class="s2">Rect</span></a>, or a <a href="../../Geometry/Point.html"><span class="s2">Point</span></a> indicating width@height.</p>
351 <p class="p8"><br></p>
352 <p class="p7"><b><span class="Apple-tab-span"> </span>asView</b></p>
353 <p class="p8"><b><span class="Apple-tab-span"> </span></b></p>
354 <p class="p7"><b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></b>Simply returns the view. Used for comptabliltiy with SCWindow.asView. If you want to guarantee that a view's parent will recieve a view, then write, e.g.:</p>
355 <p class="p8"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
356 <p class="p16"><span class="s9"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></span>{<span class="s2">arg</span> w;</p>
357 <p class="p16"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="s2">SCSlider</span>(w.asView,<span class="s2">Rect</span>(10,10,150,20)</p>
358 <p class="p16"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>}</p>
359 <p class="p5"><br></p>
360 <p class="p7"><b><span class="Apple-tab-span"> </span>getParents</b></p>
361 <p class="p8"><b><span class="Apple-tab-span"> </span></b></p>
362 <p class="p7"><b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></b>Returns and Array containting all the parents and grandparents, etc., of the view.</p>
363 <p class="p8"><br></p>
364 <p class="p7"><b><span class="Apple-tab-span"> </span>id</b></p>
365 <p class="p7"><b><span class="Apple-tab-span"> </span>id_ (id)</b></p>
366 <p class="p7"><b><span class="Apple-tab-span"> </span>findByID (id)</b></p>
367 <p class="p7"><b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></b>Internal methods.</p>
368 <p class="p8"><br></p>
369 <p class="p10"><b>Subclassing and Internal Methods: Actions</b></p>
370 <p class="p11"><br></p>
371 <p class="p1">The following methods are usually not used directly or are called by a primitive. Programmers can still call or override these as needed.</p>
372 <p class="p2"><br></p>
373 <p class="p7"><b><span class="Apple-tab-span"> </span>doAction</b></p>
374 <p class="p8"><b><span class="Apple-tab-span"> </span></b></p>
375 <p class="p7"><b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></b>Evaluates the <b>action. </b>Typically called by the primitive of a view subclass in response to some kind of user input, with the mouse, keys, etc. Many view subclasses override this methods for their own purposes.</p>
376 <p class="p8"><br></p>
377 <p class="p10"><b>Subclassing and Internal Methods: Properties</b></p>
378 <p class="p11"><br></p>
379 <p class="p1">The following methods are usually not used directly or are called by a primitive. Programmers can still call or override these as needed. In particular, there are a number of views that return property keys, which are not implemented (yet). Typically, a sub class will implement instance methods which call getPropertyor setProperty whith the name of the method as the key. For example, the method <b>knobColor_(color) </b>might call setProperty(\knobColor, color).</p>
380 <p class="p2"><br></p>
381 <p class="p7"><b><span class="Apple-tab-span"> </span>properties</b></p>
382 <p class="p8"><br></p>
383 <p class="p7"><b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></b>A list of properties to which this view responds. Most subclasses override or supplement this, getting their property list from their primitives.</p>
384 <p class="p5"><br></p>
385 <p class="p16"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>returns:</p>
386 <p class="p19"><span class="s3"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>[ </span>\bounds<span class="s3">, </span>\visible<span class="s3">, </span>\enabled<span class="s3">, </span>\canFocus<span class="s3">, </span>\resize<span class="s3">, </span>\background<span class="s3">, </span>\minWidth<span class="s3">, </span>\maxWidth<span class="s3">, </span>\minHeight<span class="s3">, </span>\maxHeight<span class="s3">, </span>\knobColor<span class="s3">, </span>\step<span class="s3">, </span>\thumbSize<span class="s3">, </span>\focusColor<span class="s3">]</span></p>
387 <p class="p5"><br></p>
388 <p class="p7"><b><span class="Apple-tab-span"> </span>getProperty (key, value)</b></p>
389 <p class="p7"><b><span class="Apple-tab-span"> </span>setProperty (key, value)</b></p>
390 <p class="p8"><b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></b></p>
391 <p class="p7"><b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></b>Sets the property at <b>key</b> to the <b>value</b>.</p>
392 <p class="p7"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>key </b>- An instance of <a href="../../Core/Symbol.html"><span class="s2">Symbol</span></a>.</p>
393 <p class="p9"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>value </b>- A value appropriate to the key.</p>
394 <p class="p12"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
395 <p class="p7"><b><span class="Apple-tab-span"> </span>setPropertyWithAction (symbol, obj)</b></p>
396 <p class="p8"><b><span class="Apple-tab-span"> </span></b></p>
397 <p class="p7"><b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></b>Sets the property and calls <b>doAction.</b></p>
398 <p class="p9"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>symbol </b>- The property key. An instance of <a href="../../Core/Symbol.html"><span class="s2">Symbol</span></a>.</p>
399 <p class="p9"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>obj </b>- a value appropriate to the key.</p>
400 <p class="p8"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
401 <p class="p7"><b><span class="Apple-tab-span"> </span>getPropertyList</b></p>
402 <p class="p8"><b><span class="Apple-tab-span"> </span></b></p>
403 <p class="p7"><b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></b>Returns an array of property keys and their values, of the form [ [\key1, value1] , [\key2, value2] ...].</p>
404 <p class="p8"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
405 <p class="p7"><b><span class="Apple-tab-span"> </span>setPropertyList (list)</b></p>
406 <p class="p8"><b><span class="Apple-tab-span"> </span></b></p>
407 <p class="p7"><b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></b>Sets a list of properties to associated values. Typically called by methods that need to set more than one property.</p>
408 <p class="p9"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>list </b>- An Array of the form [ [\key1, value1] , [\key2, value2] ...].</p>
409 <p class="p8"><br></p>
410 <p class="p10"><b>Subclassing and Internal Methods: Key Actions</b></p>
411 <p class="p11"><br></p>
412 <p class="p1">The following methods are usually not used directly or are called by a primitive. Programmers can still call or override these as needed.</p>
413 <p class="p8"><br></p>
414 <p class="p7"><b><span class="Apple-tab-span"> </span>defaultKeyUpAction</b></p>
415 <p class="p7"><b><span class="Apple-tab-span"> </span>defaultKeyDownAction</b></p>
416 <p class="p8"><b><span class="Apple-tab-span"> </span></b></p>
417 <p class="p7"><b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>These are the methods to override</b> to define defualt key actions in a subclass. The action function evaluated by default on a key action. Many views override these methods, defining their own appropreate default action. Setting the <b>keyDownAction </b>or<b> keyUpAction</b> will bypass these defaults.<span class="Apple-tab-span"> </span></p>
418 <p class="p8"><br></p>
419 <p class="p7"><b><span class="Apple-tab-span"> </span>keyTyped_(arg1)</b></p>
420 <p class="p7"><b><span class="Apple-tab-span"> </span>keyTyped</b></p>
421 <p class="p8"><b><span class="Apple-tab-span"> </span></b><span class="Apple-tab-span"> </span></p>
422 <p class="p7"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>Contains the key just typed.</p>
423 <p class="p8"><br></p>
424 <p class="p7"><b><span class="Apple-tab-span"> </span>keyDown (char, modifiers, unicode, keycode)<span class="Apple-tab-span"> </span></b></p>
425 <p class="p7"><b><span class="Apple-tab-span"> </span>keyUp (char, modifiers, unicode, keycode)</b></p>
426 <p class="p8"><b><span class="Apple-tab-span"> </span></b></p>
427 <p class="p7"><b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></b>Called by a primitive. Evaluates the <b>globalKeyDownAction</b> (<b>globalKeyUpAction</b>) and calls the <b>handleKeyDownBubbling</b> (<b>handleKeyUpBubbling</b>) method.</p>
428 <p class="p8"><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></p>
429 <p class="p7"><b><span class="Apple-tab-span"> </span>handleKeyDownBubbling (view, char, modifiers, unicode, keycode)</b></p>
430 <p class="p7"><b><span class="Apple-tab-span"> </span>handleKeyUpBubbling (view, char, modifiers, unicode, keycode)</b></p>
431 <p class="p8"><b><span class="Apple-tab-span"> </span></b></p>
432 <p class="p7"><b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></b>Called by <b>keyDown</b> or <b>keyUp,</b> and either evaluated the key actions, or bubbles up to the parent view, which may then respond.</p>
433 <p class="p5"><br></p>
434 <p class="p7"><b><span class="Apple-tab-span"> </span>keyModifiersChanged (modifiers)</b></p>
435 <p class="p8"><b><span class="Apple-tab-span"> </span></b></p>
436 <p class="p7"><b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></b>Evaluates the <b>keyModifiersChangedAction</b> and calls the <b>handleKeyModifiersChangedBubbling</b> method.</p>
437 <p class="p5"><br></p>
438 <p class="p7"><b><span class="Apple-tab-span"> </span>handleKeyModifiersChangedBubbling (view, modifiers)</b></p>
439 <p class="p8"><b><span class="Apple-tab-span"> </span></b></p>
440 <p class="p7"><b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></b>Called by <b>keyModifiersChanged,</b> and either evaluated the <b>keyModifiersChangedAction</b>, or bubbles up to the parent view, which may then respond.</p>
441 <p class="p8"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
442 <p class="p10"><b>Subclassing and Internal Methods: Mouse Actions</b></p>
443 <p class="p11"><br></p>
444 <p class="p1">The following methods are usually not used directly or are called by a primitive. Programmers can still call or override these as needed.</p>
445 <p class="p5"><br></p>
446 <p class="p7"><b><span class="Apple-tab-span"> </span>mouseDown (x, y, modifiers, buttonNumber, clickCount)</b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
447 <p class="p7"><b><span class="Apple-tab-span"> </span>mouseUp (x, y, modifiers)</b></p>
448 <p class="p7"><b><span class="Apple-tab-span"> </span>mouseMove (x, y, modifiers)</b></p>
449 <p class="p7"><b><span class="Apple-tab-span"> </span>mouseOver (x, y)</b></p>
450 <p class="p8"><b><span class="Apple-tab-span"> </span></b></p>
451 <p class="p7"><b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>These are the methods to override</b> in your subclass<b>. </b>If you override these, remember to call <b>mouseDownAction</b>, <b>mouseUpAction</b>, <b>mousMoveAction</b>, or <b>mouseOverAction</b> in your method so that users can still set addidtional custom mouse actions. These are called by the primitive.</p>
452 <p class="p8"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
453 <p class="p10"><b>Subclassing and Internal Methods: Drag and Drop Actions</b></p>
454 <p class="p11"><br></p>
455 <p class="p1">The following methods are usually not used directly or are called by a primitive. Programmers can still call or override these as needed.</p>
456 <p class="p2"><br></p>
457 <p class="p1">The next three methods are the ones you will most likely override in your custom View subclass</p>
458 <p class="p2"><br></p>
459 <p class="p7"><b><span class="Apple-tab-span"> </span>defaultGetDrag</b></p>
460 <p class="p8"><b><span class="Apple-tab-span"> </span></b></p>
461 <p class="p7"><b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>Override this in your subclass</b>. The default method for determining the content of a drag. Many subclases override this for their specific behaviors. called by <b>beginDrag</b>.</p>
462 <p class="p8"><br></p>
463 <p class="p7"><b><span class="Apple-tab-span"> </span>defaultCanReceiveDrag</b></p>
464 <p class="p8"><b><span class="Apple-tab-span"> </span></b></p>
465 <p class="p7"><b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>Override this in your subclass</b>. The default method for determining under which condidtions a view will recieve a drag. Many subclases override this for their specific behaviors. Called by <b>canReceiveDrag.</b></p>
466 <p class="p8"><b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></b></p>
467 <p class="p7"><b><span class="Apple-tab-span"> </span>defaultReceiveDrag</b></p>
468 <p class="p8"><b><span class="Apple-tab-span"> </span></b></p>
469 <p class="p7"><b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>Override this in your subclass</b>. The default method for determining what to do with a recieved . Many subclases override this for their specific behaviors. Called by <b>receiveDrag.</b></p>
470 <p class="p2"><br></p>
471 <p class="p2"><br></p>
472 <p class="p7"><b><span class="Apple-tab-span"> </span>*importDrag</b></p>
473 <p class="p8"><b><span class="Apple-tab-span"> </span></b></p>
474 <p class="p7"><b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></b>Called when an NSString is the drag object from outside of the SC app.</p>
475 <p class="p7"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>Override this in your subclass.</b></p>
476 <p class="p8"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
477 <p class="p7"><b><span class="Apple-tab-span"> </span>beginDrag</b></p>
478 <p class="p8"><b><span class="Apple-tab-span"> </span></b></p>
479 <p class="p7"><b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></b>Called by the primitive. Calls <b>beginDragAction </b>or<b> defaultGetDrag</b>, depending on whether <b>beginDragAction</b> is nil.</p>
480 <p class="p5"><br></p>
481 <p class="p7"><b><span class="Apple-tab-span"> </span>canReceiveDrag</b></p>
482 <p class="p8"><b><span class="Apple-tab-span"> </span></b></p>
483 <p class="p7"><b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></b>Called by the primitive. Calls <b>beginDragAction </b>or<b> defaultGetDrag</b>, depending on whether <b>beginDragAction</b> is nil.</p>
484 <p class="p8"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
485 <p class="p7"><b><span class="Apple-tab-span"> </span>receiveDrag (x, y)</b></p>
486 <p class="p8"><b><span class="Apple-tab-span"> </span></b></p>
487 <p class="p7"><span class="s5"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></span>Called by the primitive. Calls <b>canReceiveDragHandler.</b></p>
488 <p class="p5"><br></p>
489 <p class="p8"><b><span class="Apple-tab-span"> </span></b></p>
490 <p class="p5"><br></p>
491 </body>
492 </html>