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

Home » Public Forums » archive » Re: How to get the position of mouse
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: How to get the position of mouse [message #32739 is a reply to message #32737] Tue, 05 November 2002 05:27 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
lily_zhang (fengliza@sina.com) writes:

> I display an image on the screen first, and then intend to get the
> coordinate of mouse when I depress the left button of it. Would you
> tell me how to realize it?

In a regular graphics window, you would do something like
this:

Window
TV, image
Cursor, x, y, /Down
IF !Mouse EQ 1 THEN Print, 'You pressed LEFT button.'

But, typically, if you are asking for user input, you
will be doing this in a draw widget window, in which case
you will turn button events on for the window, and then
process the event in an event handler like this:

possibleEvents = ['DOWN', 'UP', 'MOTION']
whichButton = ['NONE', 'LEFT', 'MIDDLE', 'NONE', 'RIGHT']

thisEvent = possibleEvents[event.type]
buttonPressed = whichButton[event.press]
IF thisEvent EQ 'DOWN' THEN Print, 'You pressed the ' + $
buttonPressed + ' button down.'

Cheers,

David
--
David W. Fanning, Ph.D.
Fanning Software Consulting, Inc.
Phone: 970-221-0438, E-mail: david@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
[Message index]
 
Read Message
Read Message
Previous Topic: How to get the position of mouse
Next Topic: Re: gurus: example code as main level code ?

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

Current Time: Sat Oct 11 05:22:41 PDT 2025

Total time taken to generate the page: 0.39930 seconds