I have the code:
% Tree
function test() clc; set(groot,'Units','characters') figure('Position',[200,200,400,400]); root = uitreenode('v0', 'Datatypes', 'Datatypes', [], false); root.add(uitreenode('v0', 'Potato', 'Potato', [], true)); root.add(uitreenode('v0', 'Tomato', 'Tomato', [], true)); root.add(uitreenode('v0', 'Carrot', 'Carrot', [], true)); [mtree,container] = uitree('v0', 'Root', root,'Position',[50,50,150,150],SelectionChangeFcn, @callback); uiwait(gcf,2); root2 = uitreenode('v0', 'Datatypes2', 'Datatypes2', [], false); root2.add(uitreenode('v0', 'Carrot2', 'Carrot2', [], true)); root2.add(uitreenode('v0', 'Tomato2', 'Tomato2', [], true)); mtree.setRoot(root2); %displ tthe root and its children
root=mtree.getRoot(); rootName = root.getName(); for i=0:root.getChildCount()-1 childNode = root.getChildAt(i); childName = childNode.getName(); disp(childName); endendfunction callback(src, data) persistent x; if isempty(x) x=0; end x=x+1; disp([num2str(x) ' tree_Datatypes_Selection_Callback called']);end
Is there any way to make a callback be called on tree node double click ? At the moment is called on mouse click , not double click 🙁
Best Answer