okCombobox (Wire In)

The okCombobox allows you to relate numerical values on a Wire In endpoint to text selections in a traditional combobox.  You specify the text items and a corresponding value.  When that text item is selected, the Wire In is updated with the value.

ELEMENTTYPEDESCRIPTION
positionPOSITIONPosition of the top left corner.
sizeSIZESize in pixels.
tooltipTEXTTooltip text.
endpointHEX BYTEEndpoint address for the corresponding Wire In.
bitNUMBERBit to which this component addresses (0=LSB, 15=MSB).
optionsXMLThis field is further broken down into ‘item’ tags as shown in the example below.  Each item tag is inserted in order into the combobox.
Each item tag has a ‘value’ property which specifies the Wire In value to be used for each item selection.

XML Example

<object class="okCombobox">
	<position>180,160</position>
	<size>100,-1</size>
	<options>
		<item value="0">Test mode</item>
		<item value="1">Standard mode</item>
		<item value="2">Block floating point mode</item>
	</options>
	<endpoint>0x01</endpoint>
	<bit>1</bit>
</object>Code language: HTML, XML (xml)

Lua Scripting

This component supports executing a script function when the selection in the combobox changes. The function can get the new selection by using GetSelection() method and retrieve the associated value using GetValue():

Lua:

function OnComboboxSelect(combobox, event)
	local selection = combobox:GetSelection()
	local value = combobox:GetValue(selection)

	DebugLog("OnComboboxSelect: selection=" .. selection .. "; value=" .. value)
endCode language: JavaScript (javascript)

Combobox contents can also be dynamically modified by calling the following methods:

  • AddItem(string, value) appends a new item with the specified value.
  • Delete(index) removes the item at the specified position from the combobox.
  • Clear() removes all the items.
  • SetSelection(index) changes the selected item in the combobox to the one with the given index.

Additionally, GetCount() method can be used to retrieve the number of items in the combobox.

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