Azzera filtri
Azzera filtri

Controlling mouse pointer and responsiveness for the whole window in App Designer

5 visualizzazioni (ultimi 30 giorni)
When my app is about to start a lengthy operation, such as running a system process and waiting for its result, I want to first change the uifigure's Pointer property to 'watch' to indicate to the user that they can expect it to take some time. I usually add an onCleanup() object to revert the mouse back to 'arrow' in case the operetion fails somehow.
Problem is, the pointer change does not apply when the mouse is over some of the controls, apparently those that don't have a different pointer. Edit fields (and similar ones like spinner) show the i-beam pointer, and ignore the figure's property, even if they are not editable (this looks like a bug - these non-editable fields do not show the i-beam when the pointer is set to 'arrow').
On the other hand, when the mouse is over buttons, checkboxes etc. the pointer does change to 'watch' even though the controls are still responsive. The expected behavior when the mouse is 'watch' is to have these controls not respond to clicks, but disabling and enabling all controls individually is a big hassle.
Ideally the 'watch" pointer should apply to the whole figure and all controls should be set to ignore mouse clicks until the operation is finished. But the controls do not have a "Pointer" property and the figure does not have an "Enable" property.
I considered using a modal message box instead, but it makes no sense because the user has nothing to do except wait for the operation to complete. It is not the bebavior people are used to have in such cases.
Is there a way to apply the 'watch' pointer to the edit boxes? Is there a way to globally disable/enable all controls ?

Risposte (1)

Voss il 20 Nov 2023
"Is there a way to globally disable/enable all controls ?"
Yes. Where f is your uifigure:
h = findall(f,'-property','Enable');
set(h,'Enable','off') % disable
set(h,'Enable','on') % enable
  2 Commenti
Adee il 21 Nov 2023
Thanks, @Voss - your answer enables a solution to part my problem, the fact that some controls are still responsive while the pointer is set to "watch".
There is still the issue that some controls do not show the "watch" pointer even if they are disabled.
Voss il 21 Nov 2023
Modificato: Voss il 21 Nov 2023
You're welcome!
"some controls do not show the "watch" pointer even if they are disabled"
Yes, I tested that and observed the same behavior you did, which you mentioned in the question. It seems like a bug to me too.

Accedi per commentare.


Scopri di più su Maintain or Transition figure-Based Apps in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by