Main Content

ConnectButton

Create connect target computer button for instrument panel UI

Since R2021b

Description

example

hConnectButton = slrealtime.ui.control.ConnectButton(hFigure) creates a target computer connect-disconnect button for an instrument panel uifigure figure. This single button has two states.

  • For the connected state, the button indicates that the development computer is connected to target computer. Clicking the button disconnects the development computer from the target computer.

  • For the disconnected state, the button indicates that the development computer is disconnected from target computer. Clicking the button connects the development computer to the target computer.

For information about control properties, see slrealtime.ui Properties. If deploying an app, it is important to set the TargetSource property for this control.

Examples

collapse all

Create a target computer connect-disconnect button and adjust the position of the button.

% Create figure
hFig = uifigure();
% Create connect button component
hConnected = slrealtime.ui.control.ConnectButton(hFig);
% Change position of the component
hConnected.Position = [0 0 200 200];
% Associate with a target object
hConnected.TargetSource = 'TargetPC1';
% Customize
hConnected.ConnectedIcon = fullfile(pwd, 'myConnectedIcon.png');
hConnected.DisconnectedIcon = fullfile(pwd, 'myDisconnectedIcon.png');
hConnected.ConnectedText = 'Push to disconnect';
hConnected.DisconnectedText = 'Push to connect';

Input Arguments

collapse all

The hFigure argument identifies the uifigure to which you are adding the UI component.

Example: hFig = uifigure()

Data Types: function_handle

Output Arguments

collapse all

The hConnectButton argument is the handle to the connect button component that you create.

Version History

Introduced in R2021b