addDialogControl
Class: Simulink.dialog.Container
Package: Simulink.dialog
Add dialog control elements to mask dialog box
Syntax
Description
adds dialog control elements like text, hyperlinks, or tabs to mask dialog box.
First get the mask object and assign it to the variable successIndicator = maskObj
.addDialogControl(controlType
,controlIdentifier
)maskObj
specifies the Name and Value arguments for an element on the mask dialog box. You
can specify multiple Name-Value pairs.successIndicator = maskObj
.addDialogControl(Name,Value
)
Input Arguments
controlType
— Value type of dialog control element
character vector
Type of dialog control element, specified
'panel'
'group'
'tabcontainer'
'tab'
'collapsiblepanel'
'text'
'image'
'hyperlink'
'pushbutton'
controlIdentifer
— Unique identifier for the element
character vector
Specifies the programmatic identifier for the element of mask dialog box. Use a name that is unique and does not have space between words. For more information, see Variable Names.
Name-Value Arguments
Specify optional comma-separated pairs of Name,Value
arguments. Name
is
the argument name and Value
is the corresponding
value. Name
must appear inside single quotes ('
'
) and is case-sensitive. You can specify several name and
value pair arguments in any order as Name1,Value1,...,NameN,ValueN
.
|
Type of control that is used to specify the value of this dialog
control element. Type is a required argument. The permitted values
are |
|
The identifier of the dialog control element. Name is a required argument. This field is available for all dialog control types. |
|
Text that is displayed in the dialog control element on the Mask dialog box. This field is available for all except for panel and image dialog control types. Default: empty |
|
Option to specify whether you can set value for the dialog control element. This field is available for all dialog control types. Default: |
|
Option to set whether the dialog control element is hidden or visible to the user. This field is available for all dialog control types. Default: |
|
Container for MATLAB® code that executes when you edit the dialog control element and click Apply. This field is available only for the hyperlink and push button dialog control types. Default: empty |
|
Option to set whether the dialog control is placed in the new row or the same row. This field is available for all dialog control types. Default: empty |
|
Contains the path to an image file. This field is available for image, and push button dialog control types. Default: empty |
|
Option to specifies a container for the child dialog control.
The permitted values are the names of |
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
maskObj = Simulink.Mask.get('Engine/Gain');
% Add hyperlink to mask dialog box
maskLink = maskObj.addDialogControl('hyperlink','link_1');
maskLink.Prompt = 'Mathworks Home Page';
maskLink.Callback = 'web(''www.mathworks.com'')'
% Alternative method to add hyperlink
maskLink = maskObj.addDialogControl('hyperlink','link_2');
maskLink.Prompt = 'www.mathworks.com';
% 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';
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' maskObj = Simulink.Mask.get('GainBlock/Gain'); % 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';
Add Dialog Control Element Using Name-Value Pair
Add dialog control element and specify values for it
% Get mask object on model Engine
maskObj = Simulink.Mask.get('Engine/Gain');
% Add a dialog box and specify values for it
maskDialog = maskObj.addDialogControl('Type','text',...
'Prompt','hello','Visible','off');
Version History
Introduced in R2014a
See Also
Comando MATLAB
Hai fatto clic su un collegamento che corrisponde a questo comando MATLAB:
Esegui il comando inserendolo nella finestra di comando MATLAB. I browser web non supportano i comandi MATLAB.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)