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