okGauge (Wire Out)
The okGauge component is used to display a bar-type indicator horizontally or vertically on the panel. It connects to a Wire Out endpoint and allows a maximum range of 65535 (all 16-bits of a Wire Out). It appropriately selects the proper number of bits for smaller ranges.
ELEMENT | TYPE | DESCRIPTION |
---|---|---|
position | POSITION | Position of the top-left corner. |
size | SIZE | Size in pixels. |
tooltip | TEXT | Tooltip text. |
style | TEXT | Either “HORIZONTAL” or “VERTICAL” |
endpoint | HEX BYTE | Endpoint address for the corresponding Wire Out. |
bit | NUMBER | This bit on the endpoint is the LSB for the display. |
range | NUMBER | The maximum allowed value in the display in base 10. |
XML Example
<object class="okGauge">
<position>120,235</position>
<size>150,15</size>
<style>HORIZONTAL</style>
<range>65535</range>
<endpoint>0x33</endpoint>
<bit>0</bit>
</object>
Code language: HTML, XML (xml)
Lua Scripting
This component supports executing a script function when the value of the specified bit of the given endpoint changes. By default, the value displayed by the control will also be updated, however this can be prevented by calling event:PreventDefault()
as described in the “Default Behaviour” section of FrontPanel Scripting.
Notice that this component can also be used as a standalone indicator, not bound to any input wire. In this case it must have a name, so that it can be used by the other script functions, as otherwise it would be perfectly unusable.
The event
parameter of the script function provides GetValue()
method returning the numeric value corresponding to the new wire in value.
The gauge
object, provided to the script function, or returned by FindGauge()
method of the panel object, provides the following additional methods:
GetValue()
returns the value currently displayed by the control.SetValue(value)
allows to change this value.GetRange()
returns the current maximum range of the control.SetRange(range)
allows to change the range.
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.