WIDGEt_CONTROL, /TIMER - HOW? [message #2413] |
Tue, 05 July 1994 05:30 |
knipp
Messages: 68 Registered: January 1993
|
Member |
|
|
Hi
I fail to use the WIDGET_CONTROL, timer=x - feature.
What's wrong with the follwing code ?
(I expect to get the actual time every second, but it happens
just once).
Thank you for your answers,
Karlheinz
____________________________________________________________ __________________
__ ____ __
/ // _ \ / / Karlheinz Knipp phone: +49 511 - 762 4922
/ // /_/ // / University of Hannover fax: +49 511 - 762 2483
/ // ____// / Institute for Photogrammetry
/ // / / / Nienburger Str.1
/_//_/ /_/ FRG 30167 Hannover e-mail: knipp@ipi.uni-hannover.de
SNIP vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv vvvvvvvvvvvvv
;+
;
; test timer-feature in widgets
;
;-
; ============================================================ =================
; event handling of routine WMX_GTXT
pro wmx_x_event, event
; ------------------------------------------------------------ ------------------
; common for passing parameters between routine and _event
common wmx_x_comm, mbase, done_b
; ------------------------------------------------------------ ------------------
; widget control
name = tag_names (event, /structure_name)
WIDGET_CONTROL, event.id, GET_UVALUE = uvalue
print, systime(0), ': ', uvalue, ' ', name
if uvalue eq 'UPDATE' then print, ' TIMER ... ', systime(0)
; ------------------------------------------------------------ -----------------
; which event
case name of
"WIDGET_BUTTON": begin
if uvalue eq 'DONE' then WIDGET_CONTROL, event.top, /DESTROY
end
"WIDGET_TIMER": print, systime(0)
else: message, name + ' ???? ', /info
endcase
; ------------------------------------------------------------ -----------------
; end of routine_event ( do NOT use return )
end
; ============================================================ =================
; internal main
pro wmx_x, d1, d2
; ------------------------------------------------------------ ------------------
; check input
if n_params() ne 0 then return
; ------------------------------------------------------------ ------------------
; common for passing parameters between routine and _event
common wmx_x_comm, mbase, done_b
; ------------------------------------------------------------ ------------------
; widget, main base
mbase = WIDGET_BASE(/column, $
TITLE='TEST' , $
UVALUE="UPDATE")
; ------------------------------------------------------------ ------------------
; DONE - button
done_b = WIDGET_BUTTON(mbase, VALUE = "DONE ", UVALUE = "DONE")
; ------------------------------------------------------------ ------------------
; make widget
WIDGET_CONTROL, mbase, /REALIZE, TIMER = 1
; ------------------------------------------------------------ ------------------
; initializing xmanager
xmanager, 'wmx_x', mbase, EVENT_HANDLER='wmx_x_event', group=group
; return & end ------------------------------------------------------------ ----
return
end
SNAP ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^
|
|
|