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

Home » Public Forums » archive » Re: XY Coords & Widgets
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: XY Coords & Widgets [message #5071] Sun, 24 September 1995 00:00
mgs is currently offline  mgs
Messages: 144
Registered: March 1995
Senior Member
In article <43mojs$25h@news.isc.rit.edu>, bjp8350@osfmail.isc.rit.edu
(PRYHODA) wrote:

> I am trying to extract XY Coords from an widget_draw window. I know there
> is a function for doing this in a normal window but can this be done in a
> widgets program?

Yes. Use the event.x and event.y parameters of the returned event
structure to get the positions. Something like this will do what you're
after. There's some extra code in this for processing different mouse
buttons and whether they are pressed or released, also.

pro tmp_event, event
print, 'Press/Release: ', event.press, event.release
if (event.release gt 0) then begin
print, 'X/Y position: ', event.x, event.y
case event.release of
1: print, 'left button released'
2: print, 'middle button released'
4: print, 'right button released'
else: print, 'multi-button release (possible?)'
endcase
print
endif
end

pro tmp
base = widget_base()
draw = widget_draw(base, xsize=200, ysize=200, /button_events)
widget_control, base, /Realize
Xmanager, 'tmp', base
end

IDL> tmp
Press/Release: 1 0
Press/Release: 0 1
X/Y position: 11 192
left button released

Press/Release: 2 0
Press/Release: 0 2
X/Y position: 89 104
middle button released

Press/Release: 4 0
Press/Release: 0 4
X/Y position: 192 8
right button released

--
Mike Schienle
Custom Data Visualizations
mgs@seldon.terminus.com
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Proposed State & Federal Regulations for the INTERNET!
Next Topic: Free SPAM Program

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

Current Time: Wed Oct 08 19:42:39 PDT 2025

Total time taken to generate the page: 0.00501 seconds