How can I mouse pick up and move
5 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
For example, in following figure
I want to pick up the ball and move the position by mouse!
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/738444/image.gif)
example code or matlab function is good
0 Kommentare
Antworten (1)
Rik
am 14 Sep. 2021
Bearbeitet: Rik
am 14 Sep. 2021
Inside that callback you can retrieve the current position of the cursor (CurrentPoint) and set a flag so your WindowButtonMotionFcn can do interesting things like changing the XData and YData properties of your ball.
When the button is released you can set a flag to make the motion function return immediately after it starts (or wipe the property).
If you want a working example: you might be able to find examples on the File Exchange, but you can also have a look at my WindowLevel function, which also responds on dragging.
0 Kommentare
Siehe auch
Kategorien
Mehr zu Dialog Boxes finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!