Avoid deleting of datatip when clicking on marker
Show older comments
When creating a datatip DT, it is deleted when I click on the marker without moving the DT.
Example:
figure
h = plot(rand(100,1));
DT = datatip(h,'DataIndex',22);
Now, clicking on the marker of the DT without moving this, will delete the DT when releasing the mouse-button. Important: I still want to be able to move the DT, it should just not be deleted when clicking on it without moving it.
Is there a simple way of preventing this from happening? I implemented a solution using listeners and undocumented stuff, but I was wondering if there is a simple solution that I'm just missing.
Accepted Answer
More Answers (1)
Matlab Pro
on 6 Jun 2024
Just set the 'PickableParts' = 'none'
DT = datatip(h,'DataIndex',22,'PickableParts','none');
1 Comment
Sebastian Hölz
on 7 Jun 2024
Edited: Sebastian Hölz
on 10 Jun 2024
Categories
Find more on Code Execution in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!