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

4 ビュー (過去 30 日間)
Adee
Adee 2023 年 11 月 19 日
編集済み: Voss 2023 年 11 月 21 日
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 Center および File ExchangeApp Building についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by