CheckBoxTree - Programmatic Checking/Unchecking of Nodes
49 ビュー (過去 30 日間)
古いコメントを表示
How can I programmatically check/uncheck nodes of a CheckBoxTree?
edit: spelling
0 件のコメント
採用された回答
Randy Price
2022 年 4 月 29 日
2 件のコメント
STEVEN SATTERFIELD
2023 年 1 月 12 日
編集済み: John Kelly
2023 年 10 月 23 日
It is not the "SelectedNodes" property, but rather the "CheckedNodes" property to which you must add or remove nodes. What would be helpful is an example of how to do that.
その他の回答 (1 件)
Kris Hoffman
2023 年 3 月 3 日
編集済み: Kris Hoffman
2023 年 3 月 3 日
I'm using app designer and came across this issue. The above answers gave me the idea to simply address them in the 'CheckedNodes' attribute of the tree.
The first entry is put into the 'CheckedNodes' list does not need to be indexed.
app.Tree.CheckedNodes = app.Tree.Children(i).Children(j)
The following code adds the 3rd child of the 5th parent entry (I know it says children twice), to the end of the entries in the 'CheckedNodes' attribute.
app.Tree.CheckedNodes(end+1) = app.Tree.Children(5).Children(3)
then checking the checked nodes:
app.Tree.CheckedNodes
The last entry is there!
You can also add all entries under a "parent" node as follows:
app.Tree.CheckedNodes(end+1) = app.Tree.Children(5).Children
Now to remove a specific entry, as far as I know, you would need to know where it is in the TreeNode array. I was able to uncheck a box by using the following code.
app.Tree.CheckedNodes(2) = '';
The entry was removed and box, unchecked!
Hope that helps!
1 件のコメント
Fabian Schnurre
2023 年 12 月 7 日
string compare and everything that ai playground offers as an solution to find the place where the node is in the array doesn't work
参考
カテゴリ
Help Center および File Exchange で Downloads についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!