Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

ginput working, but crosshairs and cursor become invisible while selecting

697 views
Skip to first unread message

Thomas Dickinson

unread,
Mar 31, 2010, 11:16:04 PM3/31/10
to
Hello,

I'm using ginput when a GUI button is pressed.

I set the current figure/axes to where they should be before calling ginput:

set(0,'CurrentFigure', thePlot);
set( thePlot,'CurrentAxes',theFigure);

[deleteX,deleteY] = ginput(1)

This works (i.e. I get the right coordinates returned when I click).

However, there's a problem because the mouse cursor and ginput crosshairs become invisible when I mouse over the figure. I know the cursor isn't meant to be visible, but I thought this would be worth mentioning. It's impossible to pick the right point with no crosshairs! At least it's really hard.

For some reason, you can see the crosshairs (but still no mouse) when you mouse over the legend in the figure (the legend for the axes I'm selecting from).

If you have any suggestions, I would really appreciate you letting me know!

Thanks

Abe Lau

unread,
Apr 8, 2010, 11:34:21 PM4/8/10
to
"Thomas Dickinson" <geoffrey...@gmail.com> wrote in message <hp135k$1h0$1...@fred.mathworks.com>...

Hi Thomas,
I found similar problem where the ginput crosshairs whenever I have the color of an axes set.

E.g.
figure; h = imagesc(rand(100,100));
ginput(1) % this works nicely
set(gca, 'Color', 'b')
ginput(1) % the crosshair is gone now

I am not sure why, maybe someone would be able to explain it.

As a workaround, I copy and rename ginput.m to my working directory, and change the pointer type from 'fullcrosshair' to 'crosshair'. You may want to see if that works for you or not.

Abe

TideMan

unread,
Apr 9, 2010, 1:02:10 AM4/9/10
to
On Apr 9, 3:34 pm, "Abe Lau" <'myna...@gmail.com> wrote:
> "Thomas Dickinson" <geoffrey.seab...@gmail.com> wrote in message <hp135k$1h...@fred.mathworks.com>...

For me (using R2006a), the above works OK, but if I try to colour the
axes light green colours like f0fff0 or buff colours like ffffd8, then
my crosshairs almost disappear. They're still there, but very faint.

One solution is to use myginput from the file exchange and specify:
[x,y]=myginput(1,'crosshair');

Ryan

unread,
Feb 10, 2011, 5:22:04 PM2/10/11
to
I think I've found a solution to keeping the full cross hairs (or just cross hairs) visible. First I copied and renamed ginput.m to myginput.m in my working directory. Then in myginput.m, right below line 102, where it says:

set(fig,'pointer','fullcrosshair');

I inserted the following line:

iptPointerManager(fig, 'disable');

And now my full cross hairs stay visible. I got this idea by looking at the source code in imrect.m. By the way, my full cross hairs only went invisible when ginput.m was called from within an 'if' statement (or possibly other looping statements as well). I'm not sure why they go invisible within statements, or why the above seems to fix the problem, I just know that it worked in my case. Hopefully there are no other side effects due to the line inserted above. I've only just started using it myself, but so far it seems to be working fine.


TideMan <mul...@gmail.com> wrote in message <a3094b68-fbf3-40b4...@z7g2000yqb.googlegroups.com>...

Ryan

unread,
Feb 10, 2011, 6:14:04 PM2/10/11
to
In addition to inserting the line "iptPointerManager(fig, 'disable');" near line 102 (discussed below), I also just added the following line:

iptPointerManager(fig, 'enable');

right around line 200 just before the "end" that is just before the start of
"function key = wfbp". So that near line 200, it looks like:
...........................
end
iptPointerManager(fig, 'enable');
end

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function key = wfbp
%WFBP Replacement for WAITFORBUTTONPRESS that has no side effects.

.............................

I'm not sure if this addition is necessary, but it might help avoid the cursor getting stuck.


"Ryan " <rd...@cornell.edu> wrote in message <ij1oec$nc4$1...@fred.mathworks.com>...

0 new messages