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

Home » Public Forums » archive » Cursor Position with Draw Widget
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
Cursor Position with Draw Widget [message #3090] Wed, 02 November 1994 12:33 Go to next message
ganga is currently offline  ganga
Messages: 4
Registered: November 1994
Junior Member
Hi,

I'm trying to figure out how to return the cursor position from an
event in a draw widget. I want the coordinates to be in data
coordinates. This seems to be possible for a regular graphics window
through the cursor command, but I can't figure out how to do it within
a draw widget as the documentation says not to use the cursor command.

Any help would be appreciated. Thanks,

Ken
Re: Cursor Position with Draw Widget [message #3091 is a reply to message #3090] Thu, 03 November 1994 09:47 Go to previous message
8015 is currently offline  8015
Messages: 52
Registered: November 1993
Member
In article <398t20$6im@agate.berkeley.edu>, Ken Ganga <ganga@physics14> wrote:
> Hi,
>
> I'm trying to figure out how to return the cursor position from an
> event in a draw widget. I want the coordinates to be in data
> coordinates. This seems to be possible for a regular graphics window
> through the cursor command, but I can't figure out how to do it within
> a draw widget as the documentation says not to use the cursor command.
>

The event returned from clicking in a draw widget contains an X and Y
parameter. You should be able to access it through event.x and
event.y. Here's a line from one of my applications that handles the
data conversion, also:

ll = convert_coord(event.x, event.y, /device, /to_data)

In this case it is converting the device coordinates to data
coordinates from a map projection. A few lines later, the following
commands put lat and lon coordinates in strings:

latstr = 'Lat: ' + string(ll(1), format='(F12.2)')
lonstr = 'Lon: ' + string(ll(0), format='(F12.2)')

Hope that helps,

Mike Schienle Hughes Santa Barbara Research Center
8015@sbsun0010.sbrc.hac.com 75 Coromar Drive, M/S B28/87
Voice: (805)562-7466 Fax: (805)562-7881 Goleta, CA 93117
Re: Cursor Position with Draw Widget [message #3097 is a reply to message #3090] Wed, 02 November 1994 20:04 Go to previous message
rivers is currently offline  rivers
Messages: 228
Registered: March 1991
Senior Member
In article <398t20$6im@agate.berkeley.edu>, ganga@physics14 (Ken Ganga) writes:
> Hi,
>
> I'm trying to figure out how to return the cursor position from an
> event in a draw widget. I want the coordinates to be in data
> coordinates. This seems to be possible for a regular graphics window
> through the cursor command, but I can't figure out how to do it within
> a draw widget as the documentation says not to use the cursor command.
>

You can get the cursor position in DEVICE coordinates and then convert to DATA
coordinates with:

result = CONVERT_COORD(x, y, /device, /to_data)
Re: Cursor Position with Draw Widget [message #3099 is a reply to message #3090] Wed, 02 November 1994 15:56 Go to previous message
scott is currently offline  scott
Messages: 17
Registered: January 1994
Junior Member
Ken Ganga writes
> Hi,
>
> I'm trying to figure out how to return the cursor position from an
> event in a draw widget. I want the coordinates to be in data
> coordinates. This seems to be possible for a regular graphics window
> through the cursor command, but I can't figure out how to do it within
> a draw widget as the documentation says not to use the cursor command.
>
> Any help would be appreciated. Thanks,
>
> Ken

You get the coordinates directly from the event structure returned when
the user clicks in the Draw Widget. They are in event.X and event.y, in
device coords. To get the coords in data coords, do the following:

coords = CONVERT_COORD(event.X, event.Y, /DEVICE, /TO_DATA)

See page 1-340 of the IDL Reference Guide (v. 3.6.1) for more info, or
feel free to email me.


--
A. Scott Denning (303)491-8346
<scott@abyss.atmos.colostate.edu>
Dept. of Atmospheric Science
Colorado State University
Fort Collins, CO 80523
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Problem with Exclusive Button Widgets under IDL for Windows (V3.6.1)
Next Topic: .AVI reader in IDL

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

Current Time: Wed Oct 08 15:33:39 PDT 2025

Total time taken to generate the page: 0.00514 seconds