okStaticText
This is a simple control to display static text within a panel.
ELEMENT | TYPE | DESCRIPTION |
---|---|---|
position | POSITION | Position of the top left corner. |
size | SIZE | Size in pixels. |
label | TEXT | Label text. |
XML Example
<object class="okStaticText">
<label>Static Text</label>
<position>90,25</position>
<size>60,20</size>
</object>
Code language: HTML, XML (xml)
Lua Scripting
This component can be updated from the scripts using its SetLabel()
method, common to all controls. In order to use it, the component must be given a name, to allow finding it using FindControl()
later. For example, here is how to show today’s date in a panel:
XML:
<object class="okProfile">
<object class="okScriptCode">
<![CDATA[
function OnInit(event)
local dateText = okUI:FindPanel("panel1"):FindControl("date")
dateText:SetLabel(os.date("%Y-%m-%d"))
end
]]>
</object>
<object class="okInitScript">
<functionname>OnInit</functionname>
</object>
</object>
<object class="okPanel" name="panel1">
<title>Panel with a static text</title>
<object class="okStaticText" name="date">
<position>15,15</position>
</object>
...
</object>
Code language: HTML, XML (xml)
All XML components that support Lua scripting also inherit from the Control class. Please refer to the FrontPanel Scripting documentation for more information on this class.