how to detect double click with mouse on a tree node?
Show older comments
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);
end
end
function 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 :(
Accepted Answer
More Answers (0)
Categories
Find more on Creating, Deleting, and Querying Graphics Objects in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!