In the fourth part of the series, we look at how to change the figure pointer to a hand shape to indicate the static text can be picked up. Since the hand shape figure pointer is not available in MATLAB, we will be using the setfigptr.m from File Exchange, which has both the hand shape and the closed-hand shape (and many other useful shapes).
Implementation wise, only two lines of code needed to added to the WindowButtonMotionFcn, one line will change the figure pointer to the hand shape when the mouse moves into in the hotspot, while the other line will change the figure pointer to the default pointer when the mouse moves out of the hotspot.
1. Download mouse3.zip and ready the files in a working folder in MATLAB.
2. The setfigptr.m file is included in the zip file. Note that as I am writing this post, the one listed on File Exchange has issues.
3. Open up gui_mouse.m file, go to WindowButtonMotionFcn and copy and paste the following line of code to the corresponding conditional block,
% change to hand shape pointer
setfigptr('hand', handles.fig_mouse);
% change back to normal arrow pointer
setfigptr('arrow', handles.fig_mouse);
4. Save files and run the gui.
Video walk-through
Source Files
Download the files here.
Amazing..
ReplyDeleteThank You!