主要内容

本页采用了机器翻译。点击此处可查看英文原文。

MomentaryButton

为仪表盘用户界面创建瞬时按钮

自 R2024a 起

说明

hMomentaryButton = slrealtime.ui.control.MomentaryButton(hFigure) 为仪表板 uifigure 图形创建一个瞬时按钮。此按钮在按下时(通过计算机鼠标或其他指针设备)下载 OnValue 文件。当按钮被释放(不再按下)时,数值将恢复至按住按钮前的原始值。您可以通过按钮属性禁用此显示。

有关控制属性的信息,请参阅 slrealtime.ui Properties。若计划在默认目标计算机之外的其他计算机上使用该应用程序,则必须为该控件设置 TargetSource 属性。

示例

示例

全部折叠

创建一个实时应用程序的瞬时按钮,并调整按钮的位置。

% 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;

输入参数

全部折叠

hFigure 参量标识了您要向其添加 UI 组件的 uifigure

示例: hFig = uifigure()

数据类型: function_handle

输出参量

全部折叠

hMomentaryButton 参数是您创建的瞬时按钮组件的句柄。

版本历史记录

在 R2024a 中推出