Got a proof of concept kludged together based on this idea with timers: https://www.mathworks.com/matlabcentral/answers/348401-is-there-way-to-detect-when-a-figure-has-been-moved?s_tid=answers_rc1-3_p3_MLT
It is gross but seems to be the only way to do it that I know of. Maybe there's something buried in Java layer?
classdef FigureWithHelper < handle
properties
hFigMain;
hFigOptions;
tmr;
end
methods
function obj = FigureWithHelper()
obj.generateMainFigure();
obj.generateHelperFigure();
end
function generateMainFigure(obj)
obj.hFigMain = figure();
end
function generateHelperFigure(obj)
REPOS_TIMEOUT = 0.5;
obj.hFigOptions = figure();
obj.setHelperPos();
obj.tmr = timer('ExecutionMode', 'fixedRate',...
'Period', REPOS_TIMEOUT, ...
'TimerFcn', @obj.setHelperPos,...
'StopFcn', @(src, evt) delete(src));
start(obj.tmr);
end
function setHelperPos(obj, src, evt)
windowWidth = 250;
windowSpacer = 10;
p = obj.hFigMain.Position;
p(1) = p(1) - windowWidth - windowSpacer;
p(3) = windowWidth;
obj.hFigOptions.Position = p;
end
end
end