App Designer - Pointer update issue

9 views (last 30 days)
Gwendal Marrec
Gwendal Marrec on 5 May 2022
Commented: Geoff Hayes on 13 Jun 2022 at 20:02
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
  4 Comments
Geoff Hayes
Geoff Hayes on 13 Jun 2022 at 20:02
@Gwendal Marrec - can you provide a small working example that exhibits this behaviour?

Sign in to comment.

Answers (2)

Veronica Taurino
Veronica Taurino on 10 May 2022
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
  4 Comments
Gwendal Marrec
Gwendal Marrec on 11 May 2022
Your sample code works well for me. Really intriguing.
I'm on Windows 10 20H2.

Sign in to comment.


Gwendal Marrec
Gwendal Marrec on 13 Jun 2022 at 15:43
Up. I've tried a couple of things but none of them worked out. Whenever I call another function to handle the pointer change, it never returns to 'arrow' until I move the mouse.

Products


Release

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by