1

As the title states, I need to get a handle for my Matlab application. My class is derived from matlab.apps.AppBase and is app.UIFigure (if that matter, I'm still learning Matlab). My main goal is to change the mouse cursor to watch after a button is clicked and data is processed in the background.

I have tried:

set(gcf,'Pointer','watch') 

But gcf is just empty, so it creates a new figure. I have also gotten all of the figures, using:

figs = findall(groot,'Type','Figure')

Which finds all of the figures I am using. I believe that I need to get the overall application figure and find the handle, but I am unsure how to do that.

eye_am_groot
  • 682
  • 6
  • 19
  • The input arguments are: the class, `ButtonPushedData`. I don't see the handle in either. Could you give an example? – eye_am_groot Apr 23 '19 at 19:23
  • Ah, you're using the App Designer. I don't have much experience with that yet. The first input argument to your callback is `app`, you should be able to do `app.UIFigure.Pointer = 'watch'`? – Cris Luengo Apr 23 '19 at 19:36
  • Hmm... the warning I received included: `Functionality not supported with figures created with the uifigure function.` – eye_am_groot Apr 23 '19 at 20:24
  • Interesting... The App Designer windows and UI elements are different from the “classical” ones, and they’re also not as complete yet (new functionality is added every release). It is very conceivable that these figures don’t allow changing their mouse cursor. I don’t know. – Cris Luengo Apr 23 '19 at 20:31
  • That was my fear. And I'm struggling finding documentation... – eye_am_groot Apr 23 '19 at 20:36

1 Answers1

1

There is no pointer property for uifigure; otherwise, you would be able to use app.UIFigure.Pointer = 'watch' as suggested by @CrisLuengo.

However, specially for uifigure MATLAB provides a nice looking and powerful progress bar uiprogressdlg. You can make it indeterminate with uiprogressdlg.Indeterminate = on;. I find this working pleasingly well.

Here is an example:

f=uifigure;
progressdlg=uiprogressdlg(f,'Title','Progress','Message', 'Doing something please wait', 'Indeterminate','on');

pause(10); % Run your algorithm.

% Delete the progress bar after work done.
progressdlg.delete();

enter image description here

Anthony
  • 3,595
  • 2
  • 29
  • 38