okToggleButton (Wire In)

The okToggleButton is similar to the okPushbutton in that it connects to a Wire In endpoint.  In contrast to the okPushbutton, however, this component maintains its state just as a physical toggle switch would.  When unpressed, the corresponding wire is deasserted (logic 0).  When pressed, the corresponding wire is asserted (logic 1).

Note: This component is not presently available under OS X.

ELEMENTTYPEDESCRIPTION
positionPOSITIONPosition of the top left corner.
sizeSIZESize in pixels.
labelTEXTLabel text, shown inside the button.
tooltipTEXTTooltip text.
endpointHEX BYTEEndpoint address for the corresponding Wire In.
bitNUMBERBit to which this component addresses (0=LSB, 15=MSB).

XML Example

<object class="okToggleButton">
	<label>RA</label>
	<position>10,10</position>
	<size>20,20</size>
	<endpoint>0x00</endpoint>
	<bit>0</bit>
</object>Code language: HTML, XML (xml)

Lua Scripting

This component is similar to okPushbutton and supports executing a script function when its pressed or released. The button object passed to the script function provides a GetValue() method which can be used to determine whether the button is currently pressed or released, e.g. an example function could be written like this:

Lua:

function OnToggleEvent(button, event)
	if button:GetValue() then
		button:SetLabel("On")
	else
		button:SetLabel("Off")
	end
endCode language: JavaScript (javascript)

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.

Example Screenshot