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 CenterFile Exchange에서 App Building에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by