MATLAB Answers

Having trouble changing mouse cursor to "watch" to indicate that function is busy.

48 ビュー (過去 30 日間)
AdamG2013468
AdamG2013468 2019 年 8 月 16 日
コメント済み: Stephen Cobeldick 2019 年 8 月 16 日
I have seen similar questions asked already, but haven't had any success actually getting it to work.
The answers I have seen seem to involve some form of the following:
set(gcf, "pointer","watch"); %changes cursor to watch to indicate that the body of the function is about to execute
%----------body of funciton--------%
set(gcf, "pointer","arrow") %returns cursor to default arrow
Is this the proper way to select the mouse cursor as the current figure, or should i be creating a seperate figure handle for the cursor? When I use this method, there is no indication that the cursor has changed appearance at all. Also, I'm not sure that when using the gcf function that it the current figure is even the mouse cursor.

  0 件のコメント

サインインしてコメントする。

採用された回答

Stephen Cobeldick
Stephen Cobeldick 2019 年 8 月 16 日
編集済み: Stephen Cobeldick 2019 年 8 月 16 日
This worked for me:
set(gcf, 'Pointer','watch')
drawnow() % <- you need this
...
set(gcf, 'pointer','arrow')
Note that the changed cursor will only be visible with the cursor over that figure, and in my experience with >R2014b also responds somewhat unpredictably for different object types.
See maxdistcolor_view:
Note that obtaining and using explicit graphics handles is recommended, rather than assuming that the current figure/axes/... will be the correct one to refer to.

  4 件のコメント

表示 1 件の古いコメント
Stephen Cobeldick
Stephen Cobeldick 2019 年 8 月 16 日
I don't see anything listed in the uifigure properties that relates to the cursor:
AdamG2013468
AdamG2013468 2019 年 8 月 16 日
I tried simply using the command,
app.UIFigure.Pointer = "watch";
but I get the same error message as before. The "Pointer" property shows up in the autocomplete drop down when in app designer, so it must be a property...
Stephen Cobeldick
Stephen Cobeldick 2019 年 8 月 16 日
"The "Pointer" property shows up in the autocomplete drop down when in app designer, so it must be a property..."
Interesting... you might be able to find examples by searching the toolboxes.

サインインしてコメントする。

その他の回答 (0 件)

Community Treasure Hunt

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

Start Hunting!

Translated by