File: TextField.schelp

package info (click to toggle)
supercollider 1%3A3.13.0%2Brepack-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 80,292 kB
  • sloc: cpp: 476,363; lisp: 84,680; ansic: 77,685; sh: 25,509; python: 7,909; makefile: 3,440; perl: 1,964; javascript: 974; xml: 826; java: 677; yacc: 314; lex: 175; objc: 152; ruby: 136
file content (112 lines) | stat: -rw-r--r-- 2,295 bytes parent folder | download | duplicates (4)
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
CLASS:: TextField
summary:: A view displaying editable text
categories:: GUI>Views

DESCRIPTION::
A view displaying editable text.


CLASSMETHODS::

PRIVATE:: key



INSTANCEMETHODS::


SUBSECTION:: Data

METHOD:: string
	The text displayed in 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.

METHOD:: value
	Gets the same as link::#-string::, but when setting also sets link::#-string:: to the value interpreted link::Classes/Object#-asString#as String:: regardless of the link::#-setBoth:: flag.

	argument::
		Any object, typically one which makes sense to display as a string, such as a Float.

METHOD:: valueAction
	Sets link::#-value:: and triggers link::#-action::.


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 inside of the field under the text with the given color.

	argument::
		A Color.


SUBSECTION:: Actions

METHOD:: action
	The action object evaluated whenever the user changes the text.


SUBSECTION:: Drag and drop

METHOD:: defaultGetDrag
	returns::
		The displayed link::#-string::.

METHOD:: defaultCanReceiveDrag
	returns::
		Always true.

METHOD:: defaultReceiveDrag
	Sets link::#-valueAction:: to the current drag data.


EXAMPLES::
code::
(
w = Window.new.front;
a = TextField(w, Rect(10, 10, 150, 20));
a.string = "hi there";
a.action = {arg field; field.value.postln; };
)

// does not do the action
a.value = "yo";
a.string = "oy";

a.valueAction_("this is not a pipe"); //does the action, if the value has changed
a.doAction; //evaluates the action with the content of the text field as an argument

a.background_(Color.grey);
a.stringColor_(Color.white);
a.align_(\center);
::