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

Home » Public Forums » archive » Re: cannt disable widget timer event?
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: cannt disable widget timer event? [message #47212] Mon, 30 January 2006 21:48 Go to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Weihua FANG writes:

> here is a examle of my code. I cancel timer event by setting a negative
> value. How will you do that?

I'd do it by removing the line that sets the timer in
the "stoptimer" part of the CASE statement. :-)

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Re: cannt disable widget timer event? [message #47213 is a reply to message #47212] Mon, 30 January 2006 21:32 Go to previous messageGo to next message
Weihua FANG is currently offline  Weihua FANG
Messages: 26
Registered: January 2006
Junior Member
Hi, David,

here is a examle of my code. I cancel timer event by setting a negative
value. How will you do that?


PRO timer_example_event, ev

WIDGET_CONTROL, ev.ID, GET_UVALUE=uval
IF (TAG_NAMES(ev, /STRUCTURE_NAME) EQ 'WIDGET_TIMER') THEN BEGIN
PRINT, 'Timer Fired'
WIDGET_CONTROL, ev.TOP, TIMER=1
ENDIF

CASE uval OF
'timer' : BEGIN
WIDGET_CONTROL, ev.TOP, Timer = 1
END
'otherjobs' : BEGIN
print, 'other jobs here'
END
'stoptimer' : BEGIN
; set a negative value to slope timer
WIDGET_CONTROL, ev.TOP, TIMER=-1
END
ELSE:
ENDCASE

END

PRO timer_example

base = WIDGET_BASE(/COLUMN, UVALUE='base')
b1 = WIDGET_BUTTON(base, VALUE='Fire event', UVALUE='timer')
b2 = WIDGET_BUTTON(base, VALUE='Other job', UVALUE='otherjobs')
b3 = WIDGET_BUTTON(base, VALUE='Stop Timer', UVALUE='stoptimer')
WIDGET_CONTROL, base, /REALIZE
XMANAGER, 'timer_example', base, /NO_BLOCK

END


David Fanning 写道:

> Weihua FANG writes:
>
>> just found that setting timer to a negative value would disable timer
>> event. :-)
>
> Uh, huh. And how is that different from NOT setting
> the next timer event?
>
> Cheers,
>
> David
>
> --
> David Fanning, Ph.D.
> Fanning Software Consulting, Inc.
> Coyote's Guide to IDL Programming: http://www.dfanning.com/
Re: cannt disable widget timer event? [message #47216 is a reply to message #47213] Mon, 30 January 2006 20:03 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Weihua FANG writes:

> just found that setting timer to a negative value would disable timer
> event. :-)

Uh, huh. And how is that different from NOT setting
the next timer event?

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Re: cannt disable widget timer event? [message #47217 is a reply to message #47216] Mon, 30 January 2006 19:10 Go to previous messageGo to next message
Weihua FANG is currently offline  Weihua FANG
Messages: 26
Registered: January 2006
Junior Member
hi,

just found that setting timer to a negative value would disable timer
event. :-)

seems it is not documented in the help.


David Fanning wrote:
> Weihua FANG writes:
>
>> the problem is that I have to set and cancel timer event again and
>> again in my application.
>
> Well, that's not the *problem*, that's the *solution*. :-)
> In any case, that's how it works.
>
> Cheers,
>
> David
>
> --
> David Fanning, Ph.D.
> Fanning Software Consulting, Inc.
> Coyote's Guide to IDL Programming: http://www.dfanning.com/
Re: cannt disable widget timer event? [message #47218 is a reply to message #47217] Mon, 30 January 2006 18:53 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Weihua FANG writes:

> the problem is that I have to set and cancel timer event again and
> again in my application.

Well, that's not the *problem*, that's the *solution*. :-)
In any case, that's how it works.

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Re: cannt disable widget timer event? [message #47219 is a reply to message #47218] Mon, 30 January 2006 18:30 Go to previous messageGo to next message
Weihua FANG is currently offline  Weihua FANG
Messages: 26
Registered: January 2006
Junior Member
hi, David,

thanks for your reply.

the problem is that I have to set and cancel timer event again and
again in my application.


David Fanning wrote:
> Weihua FANG writes:
>
>> is it possible to disable widget timer event? yes, possible to avoid
>> executing part of codes in timer event procedure. but for efficient
>> consideration, is it possible to disable widget timer event like
>> disable other events, say, something like
>>
>> WIDGET_CONTROL, my_widget, DRAW_MOTION_EVENTS = 0
>>
>> WIDGET_CONTROL, my_widget, Timer_Events= 1
>> WIDGET_CONTROL, my_widget, Timer_interval= 0.2
>
> Widget timer events are one-shot events. If you don't
> set them, they don't happen. Simple as that.
>
>> Am I asking to much from IDL?
>
> Probably. I think you should ask for no events from
> your IDL programmer :-)
>
> Cheers,
>
> David
>
>
> --
> David Fanning, Ph.D.
> Fanning Software Consulting, Inc.
> Coyote's Guide to IDL Programming: http://www.dfanning.com/
Re: cannt disable widget timer event? [message #47225 is a reply to message #47219] Mon, 30 January 2006 05:21 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Weihua FANG writes:

> is it possible to disable widget timer event? yes, possible to avoid
> executing part of codes in timer event procedure. but for efficient
> consideration, is it possible to disable widget timer event like
> disable other events, say, something like
>
> WIDGET_CONTROL, my_widget, DRAW_MOTION_EVENTS = 0
>
> WIDGET_CONTROL, my_widget, Timer_Events= 1
> WIDGET_CONTROL, my_widget, Timer_interval= 0.2

Widget timer events are one-shot events. If you don't
set them, they don't happen. Simple as that.

> Am I asking to much from IDL?

Probably. I think you should ask for no events from
your IDL programmer :-)

Cheers,

David


--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Re: cannt disable widget timer event? [message #47360 is a reply to message #47212] Tue, 07 February 2006 02:43 Go to previous message
Weihua FANG is currently offline  Weihua FANG
Messages: 26
Registered: January 2006
Junior Member
well, thanks for your reply.


David Fanning wrote:
> Weihua FANG writes:
>
>> here is a examle of my code. I cancel timer event by setting a negative
>> value. How will you do that?
>
> I'd do it by removing the line that sets the timer in
> the "stoptimer" part of the CASE statement. :-)
>
> Cheers,
>
> David
> --
> David Fanning, Ph.D.
> Fanning Software Consulting, Inc.
> Coyote's Guide to IDL Programming: http://www.dfanning.com/
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: creating multiple files
Next Topic: The plot including another plot

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

Current Time: Wed Oct 08 16:04:35 PDT 2025

Total time taken to generate the page: 0.00706 seconds