Main Content

setSelectedItems

Set values for a tree

Syntax

treeControl.setSelectedItems({'Node1/ChildNode1','Node1/ChildNode2'})

Description

treeControl.setSelectedItems({'Node1/ChildNode1','Node1/ChildNode2'})set the values for the selected items in the tree.

Input Arguments

expand all

Handle to the tree, specified as an object. You can use the getDialogControl command to get the tree handle. For more information, see getDialogControl.

For example, treeControl = maskObj.getDialogControl('TreeControl'). Here, maskObj is the mask object and TreeControl is the name of the tree.

Data Types: cell array

Value to be set for selected items in the tree.

Examples

Create Tree Dialog Control

Use tree dialog control to create an interactive, hierarchical structure for selecting parameters or options within a mask.

Explore the Model

This model has a subsystem block named TreeControl. It has a tree dialog control parameter TreeControl with data.

open_system("slexMaskDialogControlExamples.slx");

Create and Insert Data into Tree Dialog Control

To create a tree dialog control:

1. Create a mask on the block TreeControl.

maskObj=Simulink.Mask.get('slexMaskDialogControlExamples/TreeControl');

2. Crete a tree dialog control.

treeControl=maskObj.getDialogControl('Control2');

3. Insert data into the tree dialog control.

treeControl = maskObj.getDialogControl('Control2');
treeControl.setSelectedItems({'Node1/ChildNode1','Node1/ChildNode2'})

Version History

Introduced in R2019b