Add just one checkbox node to a TREE (app designer)

17 ビュー (過去 30 日間)
Veronica Taurino
Veronica Taurino 2022 年 9 月 29 日
コメント済み: Eric Delgado 2022 年 10 月 17 日
Hello! Is it possible to add just one checkbox node to a standard TREE? I'm using the app designer.
Thank you in advance

採用された回答

Veronica Taurino
Veronica Taurino 2022 年 10 月 17 日
編集済み: Veronica Taurino 2022 年 10 月 17 日
I created a workaround for this problem: I used the icon property to simulate the checkbox with two images (black square: checkbox on, white square: checkbox off). A context menu on the requested node (callback hide/show) updates the icon of the node. It works. Any suggestions to improve the code?
In my app design I have something like:
%% stuff...
cm = uicontextmenu(app.UIFigure);
path="...\BLACK.png";
imgStyle = uistyle("Icon",path);
addStyle(app.TreeResults, imgStyle, "node", node)
uimenu(cm,"Text","Hide/Show polygons","MenuSelectedFcn",{@HIDE_callback, app.UIFigure, HandlePolygons});
%% stuff...
The callback to update the icon:
function HIDE_callback(~, ~, f, HandlePolygons)
if strcmpi(HandlePolygons.Visible,'off')
path="...\BLACK.png";
else
path="...\WHITE.png";
end
node= f.CurrentObject ;
imgStyle = uistyle("Icon",path);
addStyle(app.TreeResults, imgStyle, "node", node)
HandlePolygons.Visible='off';
end
  1 件のコメント
Eric Delgado
Eric Delgado 2022 年 10 月 17 日
Wow... super nice! :)

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

その他の回答 (1 件)

Eric Delgado
Eric Delgado 2022 年 9 月 29 日
No.
Each type of Tree object supports a different set of properties. For a full list of properties and descriptions for each type, see the associated property page.

カテゴリ

Help Center および File ExchangeDevelop Apps Using App Designer についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by