This page documents our Arduino library functions for updating controls on an interface panel.

Check out getting started building Arduino interfaces and processing serial commands with an Arduino for an introduction to custom user interfaces.

See updating controls from your Arduino for a walkthrough and the control reference for available controls and the methods they support.

The InterfacePanel class in the MegunoLink Pro Arduino Library provides a convenient set of methods for sending messages to MegunoLink’s Interface Panel to re-configure and request the property values of the objects shown. This library lets you send data and commands to controls on an interface panel to change property values.

Controls are identified by their Name property.

Methods

InterfacePanel(ChannelName — optional, Destination — optional ) (constructor)
SetText(ControlName, Value)
SetText(ControlName, Value, DecimalPlaces)
SetProgress(ControlName, Value)
SetNumber(ControlName, Value)
SetNumber(ControlName, Value, DecimalPlaces)
SetListIndex(ControlName, Index)
SetListValue(ControlName, Value)
SetListName(ControlName, Name)
SetCheck(ControlName, Checked — optional)
ClearCheck(ControlName)
CallCommand(CommandName)
GetValue(ControlName, PropertyName)
HideControl(ControlName)
ShowControl(ControlName, Visible — optional)
EnableControl(ControlName, Enable — optional)
DisableControl(ControlName)
SetForeColor(ControlName,Color)
SetBackColor(ControlName,Color)
SetReadOnly(ControlName, True/False)
SetMinimum(ControlName, Value)
SetMaximum(ControlName, Value)
SetGaugeLabel(ControlName, LabelIndex, LabelText)
ClearListOptions(ControlName)
SetListOption(ControlName, Value, DisplayName)
StartProgram(ControlName, [ExtraArgument])
SetTab(ControlName, TabNumber)
SetIndicator(ControlName, On)
SetIndicatorColor(ControlName, Color)

Detailed Descriptions

InterfacePanel(ChannelName — optional, Destination — optional )

Constructs an InterfacePanel variable, with an optional ChannelName and destination.

SetText(ControlName, Value)

Sets the text displayed in a control. Applies to: text box, dynamic label, button and progress bar.

SetText(ControlName, Value, DecimalPlaces)

Sets the text displayed in a control. Applies to: text box, dynamic label, button and progress bar.

SetProgress(ControlName, Value)

Sets the current value displayed by a progress bar control.

SetNumber(ControlName, Value)

Sets the number displayed in a numeric up/down, track-bar, gauge or other compatible numeric control.

SetNumber(ControlName, Value, DecimalPlaces)

Sets the number displayed in a numeric up/down, track-bar, gauge or other compatible numeric control.

SetListIndex(ControlName, Index)

Sets the index of the item selected in a value-list control. The first item in the list box is 0.

SetListValue(ControlName, Value)

Selects the item with the given value in a single-selection, value-list control. In a multi-selection value-list control, selects any items where a bitwise and between the item value and the new value is equal to the item value. This allows a list box to represent bit-flag variables.

SetListName(ControlName, Name)

Selects the item with the given name in a single-selection, value-list control.

SetCheck(ControlName, CheckState — optional)

Sets the check-state of a check box or radio button control. If the optional CheckState parameter is missing, the control is checked. Otherwise, if CheckState is:

  • true (radio button or check-box) or InterfacePanel::Checked (check-box only) then the control is checked;
  • false (radio button or check-box) or InterfacePanel::Unchecked (check-box only) then the control is unchecked;
  • InterfacePanel::Indeterminate then the control is in the indeterminate state (check-box only).

ClearCheck(ControlName)

Clears the check mark from a check box or radio button control.

CallCommand(CommandName)

Invokes a named command from the message library attached to the message processor. Typically the command returns a serial message.

GetValue(ControlName, PropertyName)

Returns the value of a serial message property for the named control. The format used for the message return is described in the Message Processor Reference.

ShowControl(ControlName, Visible — optional)

Makes a previously hidden control visible when Visible is missing or true. Visible controls are hidden when Visible is false. Applies to all controls supporting common control properties.

HideControl(ControlName)

Hides a control so it is no longer visible. Applies to all controls supporting common control properties.

EnableControl(ControlName, Enable — optional)

Enables a control so it is accessible to the user when Enable is missing or true; disables the control when Enable is false. Applies to all controls supporting common control properties.

DisableControl(ControlName)

Disables a control so it is grayed out and not accessible to the user. Applies to all controls supporting common control properties.

SetForeColor(ControlName,Color)

Controls the foreground color of the interface element. Color may be specified by name or as a six digit hexadecimal value. Hexadecimal values are specified as RRGGBB where RR, GG and BB are each two digit hexadecimal values specifying the strengths of the red, green and blue components of the color respectively. Applies to all controls supporting common control properties.

SetBackColor(ControlName,Color)

Controls the background color of the interface element. Color may be specified by name or as a six digit hexadecimal value. Hexadecimal values are specified as RRGGBB where RR, GG and BB are each two digit hexadecimal values specifying the strengths of the red, green and blue components of the color respectively. Applies to all controls supporting common control properties.

SetReadOnly(ControlName,True/False)

Set the read-only property of text box and numeric up/down controls.

SetMinimum(ControlName,Value)

Set the minimum value allowed for numeric up/down, track-bar and progress bar controls.

SetMaximum(ControlName,Value)

Set the maximum value allowed for numeric up/down, track-bar and progress bar controls.

SetGaugeLabel(ControlName, LabelIndex, LabelText)

Allows you to adjust the text for one of the labels displayed on a gauge control. In the example below we are setting the 0th label in the collection for the panel called MyGauge to display the text “Max Speed Reached”.

ClearListOptions(ControlName)

Removes all the options in a value list or value combo box control.

SetListOption(ControlName, Value, DisplayName)

Sets the display name associated with a value in a value list or value combo box control. A new item is added to the control if there isn’t an item with a matching value.

StartProgram(ComponentName), StartProgram(ComponentName, ExtraArgument)

Runs the program configured for a Start Program component. Optionally pass an additional argument to the program with the ExtraArgument variable.

SetTab(ComponentName, TabNumber)

Sets the active tab. TabNumber is the target tab index, with the first tab equal to zero.

SetIndicator(ComponentName, [On])

Sets the indicator state. On is the desired state (true or false).

SetIndicatorColor(ComponentName, Color)

Sets the color displayed when the indicator is on. Color may be specified by name or as a six digit hexadecimal value. Hexadecimal values are specified as RRGGBB where RR, GG and BB are each two digit hexadecimal values specifying the strengths of the red, green and blue components of the color respectively.

Start typing and press Enter to search