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

Home » Public Forums » archive » Problems using CURSOR
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Problems using CURSOR [message #5502 is a reply to message #5501] Wed, 17 January 1996 00:00 Go to previous messageGo to previous message
Ken Knighton is currently offline  Ken Knighton
Messages: 44
Registered: May 1995
Member
hahn@hrz.th-darmstadt.de (Norbert Hahn) wrote:
> Hi,
>
> My IDL program generates output on a terminal (either X Windows System
> or MS Windows) and wants to return 4 coordinate pairs the users
> selects. However, the following program waits only once for input and
> returns 4 time the same coordinates.

snip, snip

>
> for i=0,3 do begin
> cursor, isx, isy, wait=3
> xin(i) = isx
> yin(i) = isy
> print, isx, isy
> endfor
> end
>
> What is wrong ?

The WAIT keyword to the cursor procedure causes the cursor procedure to
wait until a mouse button is pressed or to return immediately if the
mouse button is already pressed. Using wait=3 has the same meaning
as just /WAIT. I suspect that you have confused the WAIT keyword
with the Wait argument to the cursor function. See the documentation.
What is happening with your program is that your mouse finger is too
slow. When you click the mouse, your program polls the state of the
mouse several times while the button is still down and completes the
loop. What you really want is for CURSOR to wait until a button
transition occurs.
You could have supplied the wait argument (not keyword) by:

cursor, isx, isy, 3

This would have caused CURSOR to return when a mouse button was depressed.
Alternately, (and better for readability) you could have written:

cursor, isx, isy, /DOWN

NOTE: Using X-Windows over a network is slow enough that this problem may
only occur intermittently and produce a real bothersome and hard to notice
and locate feature in your code.

I hope this helps.

Ken Knighton
Fusion Division
General Atomics
San Diego, CA
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: writing to 2 "windows" in idl?
Next Topic: Specifying a line feed

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

Current Time: Sat Oct 11 10:50:51 PDT 2025

Total time taken to generate the page: 0.79973 seconds