MATLAB Answers

Is there way to detect when a figure has been moved?

8 views (last 30 days)
I'm trying to initiate a function when a user moves the figure. All of the key or button press functions (e.g.. WindowButtonDownFcn) only become active when the mouse click occurs within the figure, not when the mouse is clicked over the Windows title bar when repositioning the figure.
Walter Roberson
Walter Roberson on 12 Jul 2017
It appears that the ResizeFcn and SizeChangedFcn will not work for this purpose.

Sign in to comment.

Accepted Answer

Image Analyst
Image Analyst on 12 Jul 2017
Maybe set up a timer to check the "Position" property of the figure window???
  1 Comment
Brad Chadwell
Brad Chadwell on 12 Jul 2017
Could be an option, but I'm hoping for an easier option that's more immediate.

Sign in to comment.

More Answers (1)

Walter Roberson
Walter Roberson on 12 Jul 2017
Add a listener on PostSet of the Position property of the figure;
Jim Hokanson
Jim Hokanson on 12 Dec 2017
property 'Position' in class 'matlab.ui.Figure' is not defined to be SetObservable.

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!