WIDGET_CONTROL, /TIMER [message #2414] |
Tue, 05 July 1994 05:02 |
knipp
Messages: 68 Registered: January 1993
|
Member |
|
|
Hi
I fail to use the WIDGEt_CONTROL, TIMER=x - feature for a regular
update of x-seconds.
What's wrong with the follwing piece of code ?
SNIP vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
;+
;
; 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' , $
FRAME=4, UVALUE="UPDATE")
; ------------------------------------------------------------ ------------------
; DONE - button
done_b = WIDGET_BUTTON(mbase, VALUE = "DONE ", UVALUE = "DONE")
; ------------------------------------------------------------ ------------------
; make widget
WIDGET_CONTROL, mbase, /REALIZE, TIMER=0.1
; ------------------------------------------------------------ ------------------
; initializing xmanager
xmanager, 'wmx_x', mbase, EVENT_HANDLER='wmx_x_event'
; return & end ------------------------------------------------------------ ----
return
end
SNAP ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
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
|
|
|