SuperCollider CLASSES

TextField

A view displaying editable text
Inherits from: TextViewBase : View : QObject : Object
Subclasses: DragView, QTextField

Description

A view displaying editable text.

Class Methods

Inherited class methods

Undocumented class methods

*qtClass

Instance Methods

Data

-string

-string = text

The text displayed in the view.

Arguments:

text

A String.

-object

-object = obj

From superclass: TextViewBase

If -setBoth is true, setting this variable also sets -string to the value interpreted as String.

Arguments:

obj

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

-setBoth

-setBoth = value

From superclass: TextViewBase

A variable stating whether setting -object will also set -string.

Arguments:

(arg1)

A Boolean.

-value

-value = val

Gets the same as -string, but when setting also sets -string to the value interpreted as String regardless of the -setBoth flag.

Arguments:

val

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

-valueAction = val

Sets -value and triggers -action.

Appearance

-align

-align = aSymbol

From superclass: TextViewBase

The alignment of the displayed text. See Alignment for possible values.

-font

-font = font

From superclass: View

The font used to display the text.

Arguments:

font

A Font.

-stringColor

-stringColor = color

The color used to display the text.

Arguments:

color

A Color.

-background

-background = color

Setting this variable colors the inside of the field under the text with the given color.

Arguments:

color

A Color.

Actions

-action

-action = func

From superclass: View

The action object evaluated whenever the user changes the text.

Drag and drop

-defaultGetDrag

Returns:

The displayed -string.

-defaultCanReceiveDrag

Returns:

Always true.

-defaultReceiveDrag

Sets -valueAction to the current drag data.

Inherited instance methods

Examples

(
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);