comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: cursor return in graphics window
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: cursor return in graphics window [message #20851] Thu, 27 July 2000 00:00
promashkin is currently offline  promashkin
Messages: 169
Registered: December 1999
Senior Member
David Fanning wrote:

> Sorry. I just *assumed* scientific programmers use widgets.
> I realize after reading my mail the past couple of days that
> this is a bad assumption. :-)

Ok, so that horrific "10 dreams" thread was at least some sort of an
eye-opener, huh ? :-) You can never know how many people are not
*writing programs* but are only typing commands. I'd say, for that
purpose Igor by WaveMetrics is better :-(

Cheers,
Pavel
Re: cursor return in graphics window [message #20852 is a reply to message #20851] Thu, 27 July 2000 00:00 Go to previous message
Eric Williams is currently offline  Eric Williams
Messages: 14
Registered: April 1997
Junior Member
Thanks David,

That did the trick. I actually have to rewrite this program because it
sucks and I want to do it with widgets. I have your programming book and
hope that will be the instruction I need to learn enough widgets to do
it efficiently.

Thanks for your help.

Eric

In article <MPG.13ea1f2b94d66170989b74@news.frii.com>,
davidf@dfanning.com (David Fanning) wrote:

> Whoops, I wrote:
>
>> Eric Williams (eric@astro.wesleyan.edu) writes:
>>
>>> I am trying to use cursor to return the coordinates of a mouse click
>>> in
>>> a graphics window. In fact I am trying to do it twice, back to back,
>>> and
>>> am running in to the problem that one mouse click is being read by
>>> both
>>> cursor calls. I want to select two points with the mouse in the
>>> graphics
>>> window but since one mouse click is being read by both cursor calls I
>>> am
>>> getting the same coordinates for each. I have tried playing with the
>>> wait keyword in cursor but that doesn't seem to make a difference.
>>>
>>> Any suggestions? I am doing this on a Mac right now but have the same
>>> problem on my Solaris boxes.
>>
>> Actually, I think your problem is that you are going through
>> your event handler twice on the *first* mouse click. Once
>> on the down event, and once on the up event. Since you weren't
>> anticipating this, you think you are getting the same
>> position from two clicks. You could modify your event
>> handler to look only for button DOWN events (event.type = 0).
>
> Sorry. I just *assumed* scientific programmers use widgets.
> I realize after reading my mail the past couple of days that
> this is a bad assumption. :-)
>
> The problem here is that default behaviour of the CURSOR
> is to be in the WAIT mode. *But* if the cursor button
> is depressed, the default behaviour is to be in a NOWAIT
> mode. On fast computers (I.e., any purchased in the past
> 10 years or so) it is impossible to punch the button fast
> enough not to get at least a couple of events generated.
>
> The solution is to simply set the DOWN keyword on the
> Cursor command.
>
> Cheers,
>
> David

--
------------
Eric Williams - Van Vleck Observatory, Wesleyan University
eric@astro.wesleyan.edu
(860) 685-3664
http://www.astro.wesleyan.edu
Re: cursor return in graphics window [message #20856 is a reply to message #20851] Thu, 27 July 2000 00:00 Go to previous message
davidf is currently offline  davidf
Messages: 2866
Registered: September 1996
Senior Member
Whoops, I wrote:

> Eric Williams (eric@astro.wesleyan.edu) writes:
>
>> I am trying to use cursor to return the coordinates of a mouse click in
>> a graphics window. In fact I am trying to do it twice, back to back, and
>> am running in to the problem that one mouse click is being read by both
>> cursor calls. I want to select two points with the mouse in the graphics
>> window but since one mouse click is being read by both cursor calls I am
>> getting the same coordinates for each. I have tried playing with the
>> wait keyword in cursor but that doesn't seem to make a difference.
>>
>> Any suggestions? I am doing this on a Mac right now but have the same
>> problem on my Solaris boxes.
>
> Actually, I think your problem is that you are going through
> your event handler twice on the *first* mouse click. Once
> on the down event, and once on the up event. Since you weren't
> anticipating this, you think you are getting the same
> position from two clicks. You could modify your event
> handler to look only for button DOWN events (event.type = 0).

Sorry. I just *assumed* scientific programmers use widgets.
I realize after reading my mail the past couple of days that
this is a bad assumption. :-)

The problem here is that default behaviour of the CURSOR
is to be in the WAIT mode. *But* if the cursor button
is depressed, the default behaviour is to be in a NOWAIT
mode. On fast computers (I.e., any purchased in the past
10 years or so) it is impossible to punch the button fast
enough not to get at least a couple of events generated.

The solution is to simply set the DOWN keyword on the
Cursor command.

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
Re: cursor return in graphics window [message #20858 is a reply to message #20851] Thu, 27 July 2000 00:00 Go to previous message
Steve Ready is currently offline  Steve Ready
Messages: 6
Registered: July 2000
Junior Member
"Eric Williams" <eric@astro.wesleyan.edu> wrote in message
news:eric-81409F.11542827072000@news.wesleyan.edu...
> Hi all,
>
> I am trying to use cursor to return the coordinates of a mouse click in
> a graphics window. In fact I am trying to do it twice, back to back, and
> am running in to the problem that one mouse click is being read by both
> cursor calls. I want to select two points with the mouse in the graphics
> window but since one mouse click is being read by both cursor calls I am
> getting the same coordinates for each. I have tried playing with the
> wait keyword in cursor but that doesn't seem to make a difference.
>
> Any suggestions? I am doing this on a Mac right now but have the same
> problem on my Solaris boxes.
>
> Thanks
> Eric Williams
> eric@astro.wesleyan.edu

I have run into this on Windows systems. It must have something to do with
the fast event detection and handling under MS Windows as I ddo not have
this problem under UNIX with X windows.

My work around is inserting a wait statement which allows for my finger to
get off the mouse button.

cursor,x,y,2,/dev ;Read position
wait,0.5
.....

Steve Ready
Xerox PARC
Re: cursor return in graphics window [message #20859 is a reply to message #20851] Thu, 27 July 2000 00:00 Go to previous message
davidf is currently offline  davidf
Messages: 2866
Registered: September 1996
Senior Member
Eric Williams (eric@astro.wesleyan.edu) writes:

> I am trying to use cursor to return the coordinates of a mouse click in
> a graphics window. In fact I am trying to do it twice, back to back, and
> am running in to the problem that one mouse click is being read by both
> cursor calls. I want to select two points with the mouse in the graphics
> window but since one mouse click is being read by both cursor calls I am
> getting the same coordinates for each. I have tried playing with the
> wait keyword in cursor but that doesn't seem to make a difference.
>
> Any suggestions? I am doing this on a Mac right now but have the same
> problem on my Solaris boxes.

Actually, I think your problem is that you are going through
your event handler twice on the *first* mouse click. Once
on the down event, and once on the up event. Since you weren't
anticipating this, you think you are getting the same
position from two clicks. You could modify your event
handler to look only for button DOWN events (event.type = 0).

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: help with future application
Next Topic: cursor return in graphics window

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Fri Oct 17 22:57:28 PDT 2025

Total time taken to generate the page: 1.11926 seconds