how to remove flag in all nodes

Hi, i've a node with more children...i want remove flag
K>> app.Tree_2
ans =
CheckBoxTree with properties:
CheckedNodes: [3×1 TreeNode]
SelectedNodes: [1×1 TreeNode]
CheckedNodesChangedFcn: ''
SelectionChangedFcn: ''
Position: [11 662.1062 220.4721 257.0796]
Show all properties

 採用された回答

Sandeep Mishra
Sandeep Mishra 2024 年 12 月 3 日

0 投票

Hi Luca,
To implement the deselection functionality on the ‘CheckBoxTree’ component, you can use the ‘SelectedNodes’ property to dynamically manage the selection state of the nodes.
Below is a code snippet demonstrating how to deselect all the nodes:
app.Tree_2.SelectedNodes = '';
Refer to the following MathWorks Documentation to learn more about ‘SelectedNodes’ property: https://www.mathworks.com/help/releases/R2024b/matlab/ref/matlab.ui.container.checkboxtree.html#mw_b3759bc1-1118-4512-8d8a-4c51ee96beda
I hope this helps!

7 件のコメント

shamal
shamal 2024 年 12 月 3 日
編集済み: shamal 2024 年 12 月 3 日
HI. I think that selected mode refers to the last one selected..But in my Node (as in the photo) I have several children to deselect. However it doesn't work
In checknode I see node with flag....In selectednode No
Walter Roberson
Walter Roberson 2024 年 12 月 3 日
app.Tree_2.SelectedNodes = [];
looks like it would work, but I am not certain that
app.Tree_2.SelectedNodes = '';
would work.
Sandeep Mishra
Sandeep Mishra 2024 年 12 月 3 日
Do you want to deselect the checked boxes like 'Static' and 'MainStrum'?
shamal
shamal 2024 年 12 月 3 日
編集済み: shamal 2024 年 12 月 3 日
i want to remove flag in all children....Static..MainStrum and all the others flagged
shamal
shamal 2024 年 12 月 3 日
@Walter Roberson No..using selected deselects only the last selected one (but does not remove the flag if it has it)
shamal
shamal 2024 年 12 月 3 日
@Sandeep Mishra excuse me..i used word "deselect" not correctly..i want to remove flag in all children
Sandeep Mishra
Sandeep Mishra 2024 年 12 月 3 日
To uncheck all the boxes in 'Tree_2' CheckBoxTree, you can use the following code:
app.Tree_2.CheckedNodes = []

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeDevelop Apps Programmatically についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by