WoW:API EditBox SetText: Difference between revisions

From AddOn Studio
Jump to navigation Jump to search
m (Move page script moved page API EditBox SetText to API EditBox SetText without leaving a redirect)
 
(3 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{widgetmethod}}
{{widgetmethod}}
__NOTOC__
__NOTOC__
<center>'''SetText''' ''-Documentation by DerGhulbus-''</center>


editBox:SetText(String)
Sets editBox's text to the specified string.


Sets the editBox's text to the specified string.
editBox:SetText(str)


==Parameters==
===Arguments===


:("String")
== Arguments ==
:;String: the string you want to appear in the EditBox
:'''str''' (string) -- the string you want to appear in the EditBox


===Returns===
== Returns ==
 
:''nil''
???
 
 
==Details==


== Details ==
You should call a SetText("") every time you read from an EditBox, so the command line is free for the next input.
You should call a SetText("") every time you read from an EditBox, so the command line is free for the next input.


==MultiLineEditBox==
SetText fails when the text contains characters that aren't renderable (e.g. control chars, invalid UTF8). In that case the EditBox is cleared and [[API EditBox GetText|EditBox:GetText()]] returns the empty string.
When using a MultiLineEditBox, there is a sub-control called Edit the actually contains the text.
For example, if the form name is "TestFourForm" and the MultilineEditBox control name is $parentMultiEditBox then you would use '''TestFourFormMultiEditBoxEdit''' to put text into the control.


<!-- begin code -->
Before {{battle-inline}} ''Battle for Azeroth'', unrenderable chars were displayed as '?'.{{fact|What does it do now?}}
TestFourFormMultiEditBoxEdit:SetText("This is a test.");
<!-- end code -->


==Also See==
== See Also ==
[[UI Escape Sequences]]
* [[UIOBJECT EditBox|EditBox object]]
* [[API EditBox GetText|EditBox:GetText()]]
* [[API EditBox GetNumber|EditBox:GetNumber()]]
* [[UI Escape Sequences]]

Latest revision as of 04:45, 15 August 2023

Widget API ← EditBox < SetText


Sets editBox's text to the specified string.

editBox:SetText(str)


Arguments[edit]

str (string) -- the string you want to appear in the EditBox

Returns[edit]

nil

Details[edit]

You should call a SetText("") every time you read from an EditBox, so the command line is free for the next input.

SetText fails when the text contains characters that aren't renderable (e.g. control chars, invalid UTF8). In that case the EditBox is cleared and EditBox:GetText() returns the empty string.

Before Template:Battle-inline Battle for Azeroth, unrenderable chars were displayed as '?'.[citation needed]

See Also[edit]