Main Content

removeDialogControl

Class: Simulink.dialog.Container
Namespace: Simulink.dialog

Remove dialog control from container in mask dialog box

Syntax

maskObj.removeDialogControl(controlIdentifier)
success = maskObj.removeDialogControl(controlIdentifier)

Description

maskObj.removeDialogControl(controlIdentifier) removes the dialog controls such as text, button, and hyperlink specified by controlIndentifier from a container in the mask dialog box. To remove a dialog control from a mask dialog box, first get the mask object and assign it to a variable maskObj.

success = maskObj.removeDialogControl(controlIdentifier) returns a logical 1 (true) when the dialog control is successfully removed or logical 0 (false) if the dialog control element is not removed from the mask dialog box.

Input Arguments

expand all

Identifier of the mask dialog control, specified as a string scalar or character vector.

Example: "text_tag"

Data Types: string | char

Examples

expand all

Remove a dialog control element from a container in the mask dialog box using removeDialogControl.

Create a new model Motor and add a Gain block.

new_system("Motor");
add_block("built-in/Gain","Motor/Gain");
save_system;
open_system("Motor");

Create a mask on the Gain block and assign the mask object to the variable maskObj.

maskObj = Simulink.Mask.create(gcb);

Create a tab container in the mask dialog box with the handle tabs.

tabs = maskObj.addDialogControl("tabcontainer","allTabs");

Add two tabs within the tab container and set prompts.

maskTab1 = tabs.addDialogControl("tab","First");
maskTab1.Prompt = "First Tab";
maskTab2 = tabs.addDialogControl("tab","Second");
maskTab2.Prompt = "Second Tab";

Remove the tab named First.

success = tabs.removeDialogControl("First")
success = logical
   1

Alternatives

You can manage dialog control elements using the Parameters & Dialog pane in the Mask Editor dialog box. For more information, see Parameters & Dialog Pane.

Version History

Introduced in R2013b