addDialogControl
Add dialog control elements to mask dialog box
Syntax
maskObj.addDialogControl(controlType,controlIdentifier)
successIndicator= maskObj.addDialogControl(Name,Value)
Description
maskObj.addDialogControl(
adds dialog control elements like text, hyperlinks, or tabs to mask dialog box. First get the
mask object and assign it to the variable controlType
,controlIdentifier
)maskObj
.
adds
dialog control elements specified by one or more successIndicator
= maskObj.addDialogControl(Name,Value
)Name,Value
pair
arguments. You can specify multiple Name-Value pairs.
Input Arguments
Examples
Add Dialog Control Elements to Mask Dialog Box
Get mask object and add dialog control element to it.
% Get mask object on model Engine new_system('Engine'); add_block('built-in/Gain','Engine/gain'); save_system; open_system('Engine'); maskObj = Simulink.Mask.create(gcb); save_system; % Add hyperlink to mask dialog box maskLink = maskObj.addDialogControl('hyperlink','link'); maskLink.Prompt = 'Mathworks Home Page'; maskLink.Callback = 'web(''www.mathworks.com'')'
maskLink = Hyperlink with properties: Name: 'link' Prompt: 'Mathworks Home Page' Callback: 'web('www.mathworks.com')' Row: 'new' Enabled: 'on' Visible: 'on' HorizontalStretch: 'on' Tooltip: ''
% Add text to mask dialog box maskText = maskObj.addDialogControl('text','text_tag'); maskText.Prompt = 'Enable range checking'; % Add button to mask dialog box maskButton = maskObj.addDialogControl('pushbutton','button_tag'); maskButton.Prompt = 'Compute'; save_system;
Add Dialog Control Elements to Mask Dialog Box Tabs
Create tabs on the mask dialog box and add elements to these tabs.
% Get mask object on a block named 'GainBlock' add_block('built-in/Gain','Engine/gain1'); maskObj = Simulink.Mask.create(gcb); maskObj = Simulink.Mask.get(gcb); % Create a tab container maskObj.addDialogControl('tabcontainer','allTabs'); tabs = maskObj.getDialogControl('allTabs'); % Create tabs and name them maskTab1 = tabs.addDialogControl('tab','First'); maskTab1.Prompt = 'First tab'; maskTab2 = tabs.addDialogControl('tab','Second'); maskTab2.Prompt = 'Second tab'; % Add elements to one of the tabs firstTab = tabs.getDialogControl('First'); firstTab.addDialogControl('text','textOnFirst'); firstTab.getDialogControl('textOnFirst').Prompt = 'Tab one'; save_system;
Add Dialog Control Element Using Name-Value Pair
Add dialog control element and specify values for it.
% Get mask object on model Engine add_block('built-in/Gain','Engine/gain2'); maskObj = Simulink.Mask.create(gcb); maskObj = Simulink.Mask.get(gcb); % Add a dialog box and specify values for it maskDialog = maskObj.addDialogControl('Name','abc','Type','text','Prompt','hello','Visible','off'); save_system;
Version History
Introduced in R2014a