rsc3/doc-schelp/Help-3.12.2/Classes/TextField.html

144 lines
12 KiB
HTML
Raw Normal View History

2022-08-24 13:53:18 +00:00
<html><head><title>TextField</title>
<link rel='stylesheet' href='./../scdoc.css' type='text/css' />
<link rel='stylesheet' href='./../frontend.css' type='text/css' />
<link rel='stylesheet' href='./../custom.css' type='text/css' />
<meta http-equiv='Content-Type' content='text/html; charset=UTF-8' />
<script src='./../scdoc.js' type='text/javascript'></script>
<script src='./../docmap.js' type='text/javascript'></script>
<script src='./../prettify.js' type='text/javascript'></script>
<script src='./../lang-sc.js' type='text/javascript'></script>
<script type='text/javascript'>var helpRoot='./..';</script>
</head>
<ul id='menubar'></ul>
<body onload='fixTOC();prettyPrint()'>
<div class='contents'>
<div class='header'>
<div id='label'>SuperCollider CLASSES</div>
<div id='categories'><a href='./../Browse.html#GUI>Views'>GUI>Views</a></div>
<h1>TextField</h1>
<div id='summary'>A view displaying editable text</div>
</div>
<div class='subheader'>
<div id='filename'>Source: <a href='file:///Applications/SuperCollider.app/Contents/Resources/SCClassLibrary/Common/GUI/Base/BasicViews.sc'>/Applications/SuperCollider.app/Contents/Resources/SCClassLibrary/Common/GUI/Base/BasicViews.sc</a></div><div id='superclasses'>Inherits from: <a href="../Classes/TextViewBase.html">TextViewBase</a> : <a href="../Classes/View.html">View</a> : <a href="../Classes/QObject.html">QObject</a> : <a href="../Classes/Object.html">Object</a></div>
<div id='subclasses'>Subclasses: <a href="../Classes/DragView.html">DragView</a>, <a href="../Classes/QTextField.html">QTextField</a></div>
</div>
<div id='toc'>
<ul class='toc'><li class='toc1'><a href='#description'>Description</a></li>
<ul class='toc'></ul><li class='toc1'><a href='#classmethods'>Class methods</a></li>
<ul class='toc'><li class='toc2'><a href='#Inherited%20class%20methods'>Inherited class methods</a></li>
<li class='toc2'><a href='#Undocumented%20class%20methods'>Undocumented class methods</a></li>
<ul class='toc'><li class='toc3'><a href='#*qtClass'>qtClass</a> </li>
</ul></ul><li class='toc1'><a href='#instancemethods'>Instance methods</a></li>
<ul class='toc'><li class='toc2'><a href='#Data'>Data</a></li>
<ul class='toc'><li class='toc3'><a href='#-string'>string</a> </li>
<li class='toc3'><a href='#-object'>object</a> </li>
<li class='toc3'><a href='#-setBoth'>setBoth</a> </li>
<li class='toc3'><a href='#-value'>value</a> </li>
<li class='toc3'><a href='#-valueAction'>valueAction</a> </li>
</ul><li class='toc2'><a href='#Appearance'>Appearance</a></li>
<ul class='toc'><li class='toc3'><a href='#-align'>align</a> </li>
<li class='toc3'><a href='#-font'>font</a> </li>
<li class='toc3'><a href='#-stringColor'>stringColor</a> </li>
<li class='toc3'><a href='#-background'>background</a> </li>
</ul><li class='toc2'><a href='#Actions'>Actions</a></li>
<ul class='toc'><li class='toc3'><a href='#-action'>action</a> </li>
</ul><li class='toc2'><a href='#Drag%20and%20drop'>Drag and drop</a></li>
<ul class='toc'><li class='toc3'><a href='#-defaultGetDrag'>defaultGetDrag</a> </li>
<li class='toc3'><a href='#-defaultCanReceiveDrag'>defaultCanReceiveDrag</a> </li>
<li class='toc3'><a href='#-defaultReceiveDrag'>defaultReceiveDrag</a> </li>
</ul><li class='toc2'><a href='#Inherited%20instance%20methods'>Inherited instance methods</a></li>
</ul><li class='toc1'><a href='#examples'>Examples</a></li>
<ul class='toc'></ul></ul></div><h2><a class='anchor' name='description'>Description</a></h2>
<p>A view displaying editable text.<h2><a class='anchor' name='classmethods'>Class Methods</a></h2>
<h3><a class='anchor' name='Inherited%20class%20methods'>Inherited class methods</a></h3>
<div id='inheritedclassmets'></div><h3><a class='anchor' name='Undocumented%20class%20methods'>Undocumented class methods</a></h3>
<h3 class='cmethodname'><span class='methprefix'>*</span><a name='*qtClass' href='./../Overviews/Methods.html#qtClass'>qtClass</a> </h3>
<h2><a class='anchor' name='instancemethods'>Instance Methods</a></h2>
<h3><a class='anchor' name='Data'>Data</a></h3>
<h3 class='imethodname'><span class='methprefix'>-</span><a name='-string' href='./../Overviews/Methods.html#string'>string</a></h3>
<h3 class='imethodname'><span class='methprefix'>-</span><a name='-string' href='./../Overviews/Methods.html#string'>string</a> = <span class='argstr'>text</span></h3>
<div class='method'>
<p> The text displayed in the view.<h4>Arguments:</h4>
<table class='arguments'>
<tr><td class='argumentname'>text<td class='argumentdesc'>
<p> A String.</table></div><h3 class='imethodname'><span class='methprefix'>-</span><a name='-object' href='./../Overviews/Methods.html#object'>object</a></h3>
<h3 class='imethodname'><span class='methprefix'>-</span><a name='-object' href='./../Overviews/Methods.html#object'>object</a> = <span class='argstr'>obj</span></h3>
<div class='supmethod'>From superclass: <a href='./../Classes/TextViewBase.html'>TextViewBase</a></div>
<div class='method'>
<p> If <a href="#-setBoth">-setBoth</a> is true, setting this variable also sets <a href="#-string">-string</a> to the value interpreted <a href="./../Classes/Object.html#-asString">as String</a>.<h4>Arguments:</h4>
<table class='arguments'>
<tr><td class='argumentname'>obj<td class='argumentdesc'>
<p> Any object, typically one which makes sense to display as a string, such as a Float.</table></div><h3 class='imethodname'><span class='methprefix'>-</span><a name='-setBoth' href='./../Overviews/Methods.html#setBoth'>setBoth</a></h3>
<h3 class='imethodname'><span class='methprefix'>-</span><a name='-setBoth' href='./../Overviews/Methods.html#setBoth'>setBoth</a> = value</h3>
<div class='supmethod'>From superclass: <a href='./../Classes/TextViewBase.html'>TextViewBase</a></div>
<div class='method'>
<p> A variable stating whether setting <a href="#-object">-object</a> will also set <a href="#-string">-string</a>.<h4>Arguments:</h4>
<table class='arguments'>
<tr><td class='argumentname'>(arg1)<td class='argumentdesc'>
<p> A Boolean.</table></div><h3 class='imethodname'><span class='methprefix'>-</span><a name='-value' href='./../Overviews/Methods.html#value'>value</a></h3>
<h3 class='imethodname'><span class='methprefix'>-</span><a name='-value' href='./../Overviews/Methods.html#value'>value</a> = <span class='argstr'>val</span></h3>
<div class='method'>
<p> Gets the same as <a href="#-string">-string</a>, but when setting also sets <a href="#-string">-string</a> to the value interpreted <a href="./../Classes/Object.html#-asString">as String</a> regardless of the <a href="#-setBoth">-setBoth</a> flag.<h4>Arguments:</h4>
<table class='arguments'>
<tr><td class='argumentname'>val<td class='argumentdesc'>
<p> Any object, typically one which makes sense to display as a string, such as a Float.</table></div><h3 class='imethodname'><span class='methprefix'>-</span><a name='-valueAction' href='./../Overviews/Methods.html#valueAction'>valueAction</a> = <span class='argstr'>val</span></h3>
<div class='method'>
<p> Sets <a href="#-value">-value</a> and triggers <a href="#-action">-action</a>.</div><h3><a class='anchor' name='Appearance'>Appearance</a></h3>
<h3 class='imethodname'><span class='methprefix'>-</span><a name='-align' href='./../Overviews/Methods.html#align'>align</a></h3>
<h3 class='imethodname'><span class='methprefix'>-</span><a name='-align' href='./../Overviews/Methods.html#align'>align</a> = <span class='argstr'>aSymbol</span></h3>
<div class='supmethod'>From superclass: <a href='./../Classes/TextViewBase.html'>TextViewBase</a></div>
<div class='method'>
<p> The alignment of the displayed text. See <a href="./../Reference/gui_alignments.html">Alignment</a> for possible values.</div><h3 class='imethodname'><span class='methprefix'>-</span><a name='-font' href='./../Overviews/Methods.html#font'>font</a></h3>
<h3 class='imethodname'><span class='methprefix'>-</span><a name='-font' href='./../Overviews/Methods.html#font'>font</a> = <span class='argstr'>font</span></h3>
<div class='supmethod'>From superclass: <a href='./../Classes/View.html'>View</a></div>
<div class='method'>
<p> The font used to display the text.<h4>Arguments:</h4>
<table class='arguments'>
<tr><td class='argumentname'>font<td class='argumentdesc'>
<p> A Font.</table></div><h3 class='imethodname'><span class='methprefix'>-</span><a name='-stringColor' href='./../Overviews/Methods.html#stringColor'>stringColor</a></h3>
<h3 class='imethodname'><span class='methprefix'>-</span><a name='-stringColor' href='./../Overviews/Methods.html#stringColor'>stringColor</a> = <span class='argstr'>color</span></h3>
<div class='method'>
<p> The color used to display the text.<h4>Arguments:</h4>
<table class='arguments'>
<tr><td class='argumentname'>color<td class='argumentdesc'>
<p> A Color.</table></div><h3 class='imethodname'><span class='methprefix'>-</span><a name='-background' href='./../Overviews/Methods.html#background'>background</a></h3>
<h3 class='imethodname'><span class='methprefix'>-</span><a name='-background' href='./../Overviews/Methods.html#background'>background</a> = <span class='argstr'>color</span></h3>
<div class='method'>
<p> Setting this variable colors the inside of the field under the text with the given color.<h4>Arguments:</h4>
<table class='arguments'>
<tr><td class='argumentname'>color<td class='argumentdesc'>
<p> A Color.</table></div><h3><a class='anchor' name='Actions'>Actions</a></h3>
<h3 class='imethodname'><span class='methprefix'>-</span><a name='-action' href='./../Overviews/Methods.html#action'>action</a></h3>
<h3 class='imethodname'><span class='methprefix'>-</span><a name='-action' href='./../Overviews/Methods.html#action'>action</a> = <span class='argstr'>func</span></h3>
<div class='supmethod'>From superclass: <a href='./../Classes/View.html'>View</a></div>
<div class='method'>
<p> The action object evaluated whenever the user changes the text.</div><h3><a class='anchor' name='Drag%20and%20drop'>Drag and drop</a></h3>
<h3 class='imethodname'><span class='methprefix'>-</span><a name='-defaultGetDrag' href='./../Overviews/Methods.html#defaultGetDrag'>defaultGetDrag</a> </h3>
<div class='method'><h4>Returns:</h4>
<div class='returnvalue'>
<p>The displayed <a href="#-string">-string</a>.</div></div><h3 class='imethodname'><span class='methprefix'>-</span><a name='-defaultCanReceiveDrag' href='./../Overviews/Methods.html#defaultCanReceiveDrag'>defaultCanReceiveDrag</a> </h3>
<div class='method'><h4>Returns:</h4>
<div class='returnvalue'>
<p>Always true.</div></div><h3 class='imethodname'><span class='methprefix'>-</span><a name='-defaultReceiveDrag' href='./../Overviews/Methods.html#defaultReceiveDrag'>defaultReceiveDrag</a> </h3>
<div class='method'>
<p> Sets <a href="#-valueAction">-valueAction</a> to the current drag data.</div><h3><a class='anchor' name='Inherited%20instance%20methods'>Inherited instance methods</a></h3>
<div id='inheritedinstmets'></div><h2><a class='anchor' name='examples'>Examples</a></h2>
<pre class='code prettyprint lang-sc'>(
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);</pre>
<div class='doclink'>helpfile source: <a href='file:///Applications/SuperCollider.app/Contents/Resources/HelpSource/Classes/TextField.schelp'>/Applications/SuperCollider.app/Contents/Resources/HelpSource/Classes/TextField.schelp</a><br>link::Classes/TextField::<br>sc version: 3.8.0</div></div></body></html>