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

7 次查看(过去 30 天)
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 ?

回答(1 个)

Voss
Voss 2023-11-20
"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 个评论
Adee
Adee 2023-11-21
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
Voss 2023-11-21
编辑:Voss 2023-11-21
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.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Migrate GUIDE Apps 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by