Re: Multiple draw widget events [message #60081] |
Fri, 02 May 2008 08:09  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
David Fanning writes:
> Something really weird is going on here!
OK, here is why I never use CW_DEFROI: it makes assumptions
about my programs that are never true. If it were me, I'd
get rid of the damn thing. :-)
One of the assumptions it makes is that the draw widget
it is interacting with does not have an event handler
assigned to it. (I can't understand how it could make
this assumption, but never mind.)
Anyway, to get your program to work, you could try
something like this in your ROI_EVENT event handler:
;*******************************************
PRO ROI_event, event
widget_control, event.top, get_uvalue=info
Widget_Control, info.draw, Draw_Motion_Events=1, EVENT_PRO=""
xsize=(size(info.image))[1]
ysize=(size(info.image))[2]
Result = CW_DEFROI(info.draw, IMAGE_SIZE=[xsize,ysize])
Widget_Control, info.draw, EVENT_PRO='Window_Event'
END
;*************************************************
Here are a couple of suggestions for you. Assign event handlers
to all of your widgets *except* the top-level base with EVENT_PRO
and EVENT_FUNC keywords, not by using XMANAGER. I'm speaking
about your button event handler, for example.
And, read this article:
http://www.dfanning.com/tips/namefiles.html
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|