MATLAB Answers

Change Mouse/ Cursor appearance in ginput

100 views (last 30 days)
Max Müller
Max Müller on 25 Sep 2014
Commented: Sean de Wolski on 25 Sep 2014
Simple Question:
is it possible to Change the Cursor appearance in ginput ?
Explanation:
If you use the ginput command, you will get a Crosshair as Cursor.Is it possible to get something like a grapping hand or ..... If you open a new figure and look into the menu bar, u will find a Pointer,a magnifier and a hand. Can i get these Objects for ginput ?

  0 Comments

Sign in to comment.

Answers (2)

Adam
Adam on 25 Sep 2014
Edited: Adam on 25 Sep 2014
As far as I know you cannot set pointer type for ginput.
might be useful to you. It is something we (the team I work in) downloaded a while back for use in place of ginput for pretty much the same reason as you. It allows you to specify pointer type.
It is a horribly named function but it does a good job.
You can use any pointer type that you can set on a fig. These can be found by just typing:
set( gcf, 'pointer' )
on any figure you have. Any option in there should be usable so far as I know and looking at the code as that is the property it sets with the pointer string you pass in.

  3 Comments

Max Müller
Max Müller on 25 Sep 2014
Does this fcn has the Output: button ? Because i am using this kind of Code:
[x,y,button] = ginput(1)
Furthermore, I guess there is no way to rename this fcn. Hence you are an advanced programmer, i guess there is no possibility right?
Adam
Adam on 25 Sep 2014
[xVal, yVal, button] = myginput( 1, 'crosshair' );
is how I used it in one of our programs so it appears to git the same syntax. The help at the top of the file also confirms syntax is identical to ginput except for the final extra argument.
It is a fileexchange download so you can simply edit the file and rename it if you want, taking note of any license requirements it has. In this case there appears to be no license file with it at all so you can do whatever you want with it for your own usage.
Obviously you could also simply create a wrapper function with a name you prefer as e.g.
function [x,y,button] = myBetterName( args )
[x,y,button] = myginput( args );
where 'args' would obviously be replaced by whatever inputs it expects. Then you can just call your own named wrapper function.
Sean de Wolski
Sean de Wolski on 25 Sep 2014
@Adam: Being covered by the BSD license explicitly allows you to modify and redistribute.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in
the documentation and/or other materials provided with the distribution
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
Not having a license means... That's why we almost never pick non-BSD files for pick of the week.

Sign in to comment.


Sean de Wolski
Sean de Wolski on 25 Sep 2014
What are you trying to do?
I typically avoid ginput and would recommend using an impoint (Image Processing Tbx req'd) instead.

  1 Comment

Max Müller
Max Müller on 25 Sep 2014
first: I am only an intern so my Supervisor has to download this, cause some how i cant.
second: thanks a lot for the help
third: I am trying to get the x and y Coordinates of a Plot with ginput in a while fcn, which is close when button > 1.

Sign in to comment.

Sign in to answer this question.