X
PrevPrev Go to previous topic
NextNext Go to next topic
Last Post 14 Mar 2008 06:55 PM by  anon
Timed events
 1 Replies
Sort:
You are not authorized to post a reply.
Author Messages

anon



New Member


Posts:
New Member


--
14 Mar 2008 06:55 PM
    I am trying to get idl to start a routine every 5 minutes, while the user of the program should still be able to work on a widget interface. My program should run under a virtual machine environment, check for new data automatically every five minutes, and still allow data browsing by using widgets while waiting for new data. I tried using void IDL_TimerSet(1000.*15.,refresh_routine,0,0) but only get 'syntax error' for IDL_Timerset. This happens in IDL 5.5 (as well as for 6.4 demo mode) on a linux machine. Looks like IDL doesnt recognize IDL_TimerSet. What could be the problem? Is there another way of triggering a 'data refresh' routine every 5 minutes while still being able to use a widget GUI at the same time? (and to keep it executable under IDL Virtual Machine)

    Deleted User



    New Member


    Posts:
    New Member


    --
    14 Mar 2008 06:55 PM
    I see how a search on string "timer" in IDL Online Help takes you first to this IDL_TimerSet. And, if you are not an "external development" programmer (a programmer that interfaces IDL to other computer languages) it is not easy to see that 'IDL_TimerSet' is a C function, not an IDL routine. You need to be rather working with WIDGET_TIMER, not an easy subject to find in IDL Online Help. The link is through the 'Index' tab of Help ('timers -> widget timer') or through a general Help Search for the topic "Working with widget events", where "Timer Events" is a subtopic. Here is an example that I wrote several years ago: ; File: 'button_and_timer.pro' ; Syntax: BUTTON_AND_TIMER ; Purpose: Demonstrate timer events juxtaposed with button events ; Instructions: This program starts a widget with one button in its center. ; Pressing the button causes "You pressed me" to be IMMEDIATELY ; printed in the IDL output log. Besides this, a timer event attached to ; the top-level base will print to the IDL output log "Timer just triggered" ; every 2 seconds. ; Event handler code PRO button_and_timer_event, event ; Handle the timer event if tag_names(event, /STRUCTURE_NAME) eq 'WIDGET_TIMER' then begin print, 'Timer just triggered' widget_control, event.top, timer=2.0 endif ; Handle the button event if tag_names(event, /STRUCTURE_NAME) eq 'WIDGET_BUTTON' then begin print, 'You pressed me' endif END ; Widget creation code PRO button_and_timer tlb = widget_base(/COLUMN, /BASE_ALIGN_CENTER, XSIZE = 240, $ YSIZE=50, TITLE='Base w/Button & Timer') wButton = widget_button(tlb, value='Press Me') widget_control, tlb, /realize, timer=2.0 xmanager, 'button_and_timer', tlb END James Jones
    You are not authorized to post a reply.