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

Home » Public Forums » archive » Multiple widget_draw's and bad convert_coord
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
Multiple widget_draw's and bad convert_coord [message #25913] Tue, 24 July 2001 12:43
Todd Clements is currently offline  Todd Clements
Messages: 23
Registered: January 2001
Junior Member
Hi all...

The attached sample code shows my problem. I have multiple widget_draws
in a program that I'm writing, and I get button events from them so I
can let the user select portions of a correlated spectrum to use as a
gate for another spectrum. Anyway, I need to be able to get the
coordinates that were selected in multiple plots (one at a time, of
course), but when I try to do this, convert_coord always returns the
coordinates from the last plot even if I'm clicking in the first plot,
no matter how often I use wset to try and set the window.

In the example below, clicking in either the top plot or the bottom plot
returns coordinates from the bottom plot. And you can complain about my
use of common blocks some other time... I just wanted to get a sample
program out the door. =)


print, !version
{ alpha OSF unix 5.4.1 Jan 16 2001 64 64}

;;----- Begin test code ---------
pro bad_test_event, ev, base
common windowstuff, win1, win2, widget1, widget2

if( tag_names( ev, /structure_name ) eq 'WIDGET_DRAW' ) then begin
case ev.id of
widget1: begin
wset, win1
result = convert_coord( ev.x, ev.y, /device, /to_data )
print, result
end
widget2: begin
wset, win2
result = convert_coord( ev.x, ev.y, /device, /to_data )
print, result
end
endcase
endif
end ;; bad_test_event

pro bad_test
common windowstuff, win1, win2, widget1, widget2

base = widget_base( /column )
widget1 = widget_draw( base, xsize=300, ysize=300, /button_events )
widget2 = widget_draw( base, xsize=300, ysize=300, /button_events )

widget_control, base, /realize

widget_control, widget1, get_value = win1
widget_control, widget2, get_value = win2

wset, win1
plot, findgen(50), findgen(50)^2

wset, win2
plot, findgen(50)+50, sin(findgen(50)/49.*!pi)

wset, win1
xmanager, 'bad_test', base

end
;; --------- End test code ---------------

Thanks in advance for any help!
Todd
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: PostScript with smooth lines from object graphics?
Next Topic: Re: FFT in a 2D variable in only one direction

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

Current Time: Wed Oct 08 18:39:59 PDT 2025

Total time taken to generate the page: 0.00780 seconds