API:ButtonSetText
From RoR Wiki
UI Lua API · Button functions
Version: WAR 1.4.8
Sets the text shown on a Button.
ButtonSetText(buttonName, text)
Arguments
- buttonName
string– Name of a Button window.- text
wstring– The text to show. It must be a wide string:L"Accept"works,"Accept"does not.
Returns
Nothing.
Details
- Passing an ordinary Lua string or a number as
textraises an Invalid Parameters error. Convert withtowstring()first if necessary. - A Button with no text label (for example an icon-only button) silently ignores the call.
- If the button is set to resize to its text, it is resized to fit the new text, plus its text padding on each side.
- If the text does not fit, the client may print one of these warnings to the debug log. This happens only for buttons that have clipping warnings enabled.
Text is cut off in Button %s.Font sized is auto-scaled down in Button %s.
- The function needs at least two arguments and only reads the last two.
Errors
Error in function call 'ButtonSetText': Window %s does not existError in function call 'ButtonSetText': Window %s is not a Button
Example
From easystem_dialogmanager/source/dialogmanager.lua:
ButtonSetText( "TextEntryDlg"..dlg.."ButtonCancel", GetPregameString(StringTables.Pregame.LABEL_CANCEL) ) ButtonSetText( "OneButtonDlg"..dlgIndex.."BoxButton1", buttonText )
