MATLAB GUI mouse shape control

I want to design a gui. And when the cursor point to different part of the GUI, I want it to change the shape itself. Such as becoming a cross or a hand when the cursor point to the image.

댓글 수: 1

Adam Danz
Adam Danz 2020년 6월 25일
편집: Adam Danz 2021년 8월 14일
along with
can be used to automatically change the pointer symbol when it hovers over certain objects within the GUI. In regular figures, the pointer manager is supported with figure | axes | uipanel | image objects. As of r2020a, the pointer manager can also be used with uifigures but it seems that only uifigure and uiaxes are supported plus any object plotted within the axes (see demo).

댓글을 달려면 로그인하십시오.

답변 (1개)

Image Analyst
Image Analyst 2015년 7월 21일

1 개 추천

Like this?
% Change mouse pointer (cursor) to an arrow.
set(gcf,'Pointer','arrow')
drawnow; % Cursor won't change right away unless you do this.
% Change mouse pointer (cursor) to an hourglass.
% QUIRK: use 'watch' and you'll actually get an hourglass not a watch.
set(gcf,'Pointer','watch');
drawnow; % Cursor won't change right away unless you do this.

댓글 수: 4

Guanfeng Gao
Guanfeng Gao 2015년 7월 21일
Yes, YOU ARE right. But how to trigger the command. I want to know how the GUI know where the cursor is, so the pointer can change correspond to the place of the cursor it is.
Image Analyst
Image Analyst 2015년 7월 21일
If you want to change it depending on where in the GUI the cursor is located, you're going to have to put that in a call to the mousemove event.
Guanfeng Gao
Guanfeng Gao 2015년 7월 21일
Thanks. I have already solved the problem.
To get all available cursors, type:
set(gcf,'Pointer')
each one of the resulted list can be used as the 3rd input to the set function.

댓글을 달려면 로그인하십시오.

질문:

2015년 7월 21일

편집:

2021년 8월 14일

Community Treasure Hunt

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

Start Hunting!

Translated by