Button

The button control is used to send commands to a connected device.

Commands are sent when an event, such as the user clicking the button, occurs. Commands are text strings and may include values from other controls such as text boxes or numeric controls.

The label displayed on the button is set using the Text property.

Button control properties
Property Access Type Method Description
Name Read only string The name of the control
OnClickSend Design-only string The command to send to your Arduino sketch when the button control is clicked.
OnDoubleClickSend Design-only string The command to send to your Arduino sketch when the button is quickly clicked twice.
OnMouseDownSend Design-only string The command to send to your Arduino sketch when the mouse button is pressed on the control.
OnMouseUpSend Design-only string The command to send to your Arduino sketch when the mouse button is released on the control.
Text Read/write string SetText The string displayed on the button
TextLength Read only int Gets the length of text in the control.
ConfirmBeforeSending Design only bool When true, the ConfirmationPrompt is displayed with Yes and No buttons when the button is clicked. The OnClickSend message is only sent if the user clicks the Yes button.
ConfirmationPrompt Design only string A custom message displayed to the user when the button is clicked and ConfirmBeforeSending is true.

This control also supports all the common control properties. It also supports the following methods, which can be used when creating serial commands.

Button control methods
Name Returns Description
FixedLengthText(int Length) string Returns the first Length characters from the control value. If the value is shorter than Length spaces (‘ ‘) will be added to the end until it is exactly Length characters long.
FixedLengthText(int Length, string Alignment) string Returns the first Length characters from the control value. If the value is shorter than Length spaces (‘ ‘) will be added to the value until it is exactly Length characters long. Spaces are added to the start or end of the value when Alignment is Right or Left. If Alignment is Center an equal number of spaces is added to the start and end of the value.
FixedLengthText(int Length, string Alignment, char Padding) string Returns the first Length characters from the control value. If the value is shorter than Length the Padding character will be added to the value until it is exactly Length characters long. The Padding character is added to the start or end of the value when Alignment is Right or Left. If Alignment is Center an equal number of Padding characters is added to the start and end of the value.

Start typing and press Enter to search