okSlider (Wire In)

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).
minvalueNUMBERThe minimum value on the slider in base 10.
maxvalueNUMBERThe maximum value on the slider in base 10. This cannot exceed 255.
valueNUMBERDefault value taken when the profile is loaded.
styleSTYLEVERTICAL – Displays the slider vertically.HORIZONTAL – Displays the silder horizontally.SHOWLABELS – Show min/max/value labels.

XML Example

<object class="okSlider">
	<position>310,5</position>
	<size>25,100</size>
	<label>Hi</label>
	<tooltip>4-bit vertical slider.</tooltip>
	<style>VERTICAL|SHOWLABELS</style>
	<minvalue>0</minvalue>
	<maxvalue>15</maxvalue>
	<value>3</value>
	<endpoint>0x04</endpoint>
	<bit>4</bit>
</object>Code language: HTML, XML (xml)

Lua Scripting

This component supports executing a script function when its value changes. The current value can be obtained by using GetValue() method and changed using SetValue(), for example here is a function that could be used to maintain the sum of two sliders values constant:

Lua:

function OnSlider(slider, event)
	local value = slider:GetValue();

	local slider2 = okUI:FindPanel("panel1"):FindSlider("slider2")
	slider2:SetValue(255 - value)
endCode language: JavaScript (javascript)

Assuming the panel contains the following elements:

XML:

<object class="okSlider">
	<position>15,15</position>
	<size>200,30</size>
	<style>HORIZONTAL</style>
	<minvalue>0</minvalue>
	<maxvalue>255</maxvalue>
	<value>0</value>
	<functionname>OnSlider</functionname>
</object>

<object class="okSlider" name="slider2">
	<position>15,50</position>
	<size>200,30</size>
	<minvalue>0</minvalue>
	<maxvalue>255</maxvalue>
	<value>255</value>
</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.

Example Screenshot