Main Content

MomentaryButton

Create momentary button for instrument panel UI

Since R2024a

Description

example

hMomentaryButton = slrealtime.ui.control.MomentaryButton(hFigure) creates a momentary button for an instrument panel uifigure figure. This button downloads the OnValue while the button is pressed by using the computer mouse or other pointing device. When the button is released (no longer pressed), the value reverts to the original value from before the press-and-hold of the button. You can disable this display by using a button property.

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 real-time application momentary button and adjust the position of the button.

% Create figure
hFig = uifigure();
% Create momentary button component
hMomentaried = slrealtime.ui.control.MomentaryButton(hFig);
% Change position of the component
hLoaded.Position = [0 0 200 200];
% Customize
hMomentaried.BlockPath = 'testmodel/Constant6';
hMomentaried.ParameterName = 'Value';
hMomentaried.OnValue = 1;

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 hMomentaryButton argument is the handle to the momentary button component that you create.

Version History

Introduced in R2024a