I have a problem with a two tlb widget program. What I want is when
the user press enter on the cw_field widget in the second tlb, the
plot on the second tlb should be refreshed. But the program runs very
weird, when user press the enter, it just waiting, only after you move
the mouse to the draw widget on the first tlb, it begin to refresh the
draw widget on the second tlb. Following are the codes, any
suggestions are highly appreciated.
;definition
tlb=widget_base(title='MetabROI', $ ;top level base
/row, $
mbar=menubar)
;draw widget on the first tlb
image_base=widget_base(tlb, /row)
image_draw=widget_draw(image_base, $ scr_xsize=1024, $
scr_ysize=1024, $
button_event=1, $
motion_event=1, $
event_pro='roi')
;second tlb
tlb1 = Widget_Base(Group_Leader=tlb, $
column, $
/TLB_KILL_REQUEST_EVENTS, $
event_pro = "tlb1_iconify", $
Title='Average Spectroscopy')
specwindow_base=widget_base(tlb1, $
/row)
specdraw = Widget_Draw(specwindow_base, $
XSize=1024, $
YSize=632 $
)
specbutton_base=widget_base(tlb1, $
/row, $
event_pro = 'range' $
)
startpoint = cw_field(specbutton_base, $
/return_events, $
title = 'START POINT', $
xsize = 8 $
)
endpoint = cw_field(specbutton_base, $
/return_events, $
title = 'END POINT', $
xsize = 8 $
)
;codes realize second tlb
widget_control, event.top, get_uvalue = pinfo
widget_control, (*pinfo).tlb1, /realize
widget_control, (*pinfo).specdraw, get_value=specdraw_id
(*pinfo).specdraw_id = specdraw_id
widget_control, (*pinfo).tlb1, set_uvalue = pinfo
;second tlb event block codes
widget_control, event.top, get_uvalue = pinfo
widget_control, (*pinfo).startpoint, get_value = startpoint
startpoint = round(fix(startpoint))
widget_control, (*pinfo).endpoint, get_value = endpoint
endpoint = round(fix(endpoint))
wset, (*pinfo).specdraw_id
erase
wshow, (*pinfo).specdraw_id
;draw it
plot, *(*pinfo).avg_spec, $
xrange = [startpoint, endpoint], $
Xstyle = 1, $
/device
|