App Designer - Pointer update issue
조회 수: 21 (최근 30일)
이전 댓글 표시
Hello,
I am working on an App Designer app.
I have coded the function below. It is supposed to change the pointer to watch if it is an arrow or to arrow if it is a watch.
methods (Access = public)
function pointer_change(app)
if app.UIFigure.Pointer == 'arrow'
set(app.UIFigure, 'pointer', 'watch');
else
set(app.UIFigure, 'pointer', 'arrow');
end
drawnow()
end
end
All my callbacks look like this :
function callback1(app, event)
pointer_change(app);
%some code that takes a long time to run so I need to change the cursor
%to indicate that matlab is busy running
pointer_change(app);
end
When I change the pointer from 'watch' to 'arrow' (which corresponds to the second call of pointer_change), the pointer is not updated until I move the mouse, as if the drawnow statement was not executed. As soon as I move the mouse, the pointer becomes an arrow.
Does anyone know why ?
Many thanks,
Gwendal
댓글 수: 6
Geoff Hayes
2022년 8월 15일
@Gwendal Marrec - could you attach a simplified version of your GUI that exhibits this behaviour?
답변 (4개)
ryugasen
2022년 8월 25일
I was having the same issue with only one situation, and upon looking on your example, I think I found the culprit. It's related to opening a file (I have a pointer change at two different callback functions, it works perfectly in one where it does a calculation, while in the one that loads an excel file through readmatrix it doesn't work until I move the cursor).
Interestingly, I found that if the app is maximised, it works perfectly regardless. I suspect it has something to do with the window of the app becoming out of focus when you go and load a file (and only upon the moving the mouse does Windows realise the app is still the window of focus). If the app is maximising, I guess Windows always treats it as the focus.
So yeah, the solution is to keep the app maximised, or if someone with more tech knowledge knows how to keep the app in focus even while Windows browses and opens a different file in the background, then that would be the best solution
댓글 수: 0
Veronica Taurino
2022년 5월 10일
I have the same problem. The pointer does not change until I move the cursor. I am working in the app designer, each callback has something like:
function callback1(app, event)
set(app.UIFigure, 'Pointer','watch')
% do stuff...
set(app.UIFigure, 'Pointer','arrow')
end
댓글 수: 5
Veronica Taurino
2023년 5월 30일
편집: Veronica Taurino
2023년 5월 30일
after a year, I still have the same issue.
I solved it programatically moving a bit the cursor at the end of the process:
hroot=groot;
pp=get(hroot,'PointerLocation'); % current cursor position
set(hroot,'PointerLocation',[pp(1)+10 ,pp(2)+10 ]); %slightly moving cursor
Veronica Taurino
2023년 5월 30일
after a year, I still have the same issue.
I solved it programatically, moving a bit the cursor at the end of the process:
hroot=groot;
pp=get(hroot,'PointerLocation'); % current cursor position
set(hroot,'PointerLocation',[pp(1)+10 ,pp(2)+10]); %slightly moving cursor
댓글 수: 0
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!