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

Home » Public Forums » archive » Re: Multiple draw widget events
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: Multiple draw widget events [message #60081] Fri, 02 May 2008 08:09 Go to next message
David Fanning is currently offline  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.")
Re: Multiple draw widget events [message #60083 is a reply to message #60081] Fri, 02 May 2008 07:21 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Jye writes:

> Another newbie here so the answer to my problem is most likely
> blatently obvious.
>
> The example below is of a draw widget which windows the displayed
> image when right clicked on the draw widget and the ROI button runs
> CW_DEFROI. But my problem is that the windowing events interfere when
> CW_DEFROI is called! How can I stop this from happening? Im sure it
> has something to do with the /no_block keyword but I have been unable
> to find the solution.
>
> Any help is greatly appreciated.

Something really weird is going on here!

I have to confess, I have never used CW_DEFROI, because I have
never been able to figure it out. But, clearly, it has its
own event loop, and we are meant to *stay* in that event loop
until we exit the CW_DEFROI program (WHILE 1 DO...). Nothing
else should be happening.

But while it does *appear* to be stuck inside its own
event loop, other events can be processed and sent to
other event handlers, etc. As I say, too, too weird!!

I don't have time this morning to fool around with it,
and I have a busy weekend planned (learning about native
plants), but maybe I'll come back to this when I get
a moment. There is something to be learned here, I just
don't know exactly what yet. :-)

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.")
Re: Multiple draw widget events [message #60084 is a reply to message #60083] Fri, 02 May 2008 06:54 Go to previous messageGo to next message
ben.bighair is currently offline  ben.bighair
Messages: 221
Registered: April 2007
Senior Member
On May 2, 1:49 am, Jye <jye.sm...@gmail.com> wrote:
> Hi,
>
> Another newbie here so the answer to my problem is most likely
> blatently obvious.
>
> The example below is of a draw widget which windows the displayed
> image when right clicked on the draw widget and the ROI button runs
> CW_DEFROI. But my problem is that the windowing events interfere when
> CW_DEFROI is called! How can I stop this from happening? Im sure it
> has something to do with the /no_block keyword but I have been unable
> to find the solution.
>
> Any help is greatly appreciated.
>
> Cheers
> Jye

Hi,

I am not sure what you are saying is the interference, but I'll guess
that it is the grayscale shifting with the motion events. You are
explicitly turning motion events on in your ROI_EVENT handler.
Removing that line (or setting DRAW_MOTION_EVENTS = 0) will prevent
motion events from occurring.

Cheers,
Ben


>
> ;----------------------------------------------------------- ---------------------------------
> ; ROI
> ;----------------------------------------------------------- ---------------------------------
>
> PRO ROI_event, event
> widget_control, event.top, get_uvalue=info
>
> Widget_Control, info.draw, Draw_Motion_Events=1
>
> xsize=(size(info.image))[1]
> ysize=(size(info.image))[2]
>
> Result = CW_DEFROI(info.draw, IMAGE_SIZE=[xsize,ysize])
>
> END
>
Re: Multiple draw widget events [message #60185 is a reply to message #60083] Mon, 05 May 2008 18:07 Go to previous message
Jye is currently offline  Jye
Messages: 17
Registered: May 2008
Junior Member
> I don't have time this morning to fool around with it,
> and I have a busy weekend planned (learning about native
> plants), but maybe I'll come back to this when I get
> a moment. There is something to be learned here, I just
> don't know exactly what yet. :-)

Thanks for the speedy reply David and the link :) Ive been referencing
your site and book while getting my head around IDL and both have been
very useful.

Cheers
Jye
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: problem with display the data
Next Topic: LINBGC problem

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

Current Time: Wed Oct 08 18:55:58 PDT 2025

Total time taken to generate the page: 0.00602 seconds