hi guys,
I have a widget base(1) with a couple of buttons on it, and when i click one of the buttons it brings up a base widget(2) containing a draw widget and a couple of fields from which I want to save the input to do stuff in that first widget with all the bottons (so when i click a button there, i can use the data I got from (2) to do stuff in (1)).
The code for widget 1 is in one .pro file, and the code for widget 2 is in another. Would this be the reason the information is not transferring between the two? I thought that would be ok. Or maybe my code is crazy (which is most probable)
here is what I have in the widget 1 definition module to get to widget 2 (the .......'s are just to save space):
w_userRoi= widget_button(p,value = 'Get User Defined ROI',frame = 2,$
event_pro = 'userROI')
widget_control,w_top , set_uval = { .........,$
userROI: -1L,$ ;since I don't have an event structure yet. Maybe I should put something else here??
userCon: w_userCon,$
cx1: w_cx1 ,$
..........,$etcetcetc}
and here is my actual UserROI code, in UserROI.pro
Pro UserROI, event
tlb = Widget_Base(Title='User Defined ROI', row=4,xsize=260, $
/Base_Align_Center, Group_Leader=event.top)
drawID = Widget_Draw(tlb, Xsize=260,Ysize=260, uvalue=13)
widget_control, drawID, get_value=wid
wset, wid
;get data from widget 1
widget_control, event.top, get_uval = w
widget_control, w.imagevu, get_uval = w
widget_control, w.cw_image, get_uval=w
widget_control, w.data, get_uval = d
widget_control, w.stretch, get_uval=s
widget_control,s.smin, get_valu=smin
widget_control,s.smax, get_valu=smax
image=congrid(d.image, 260,260)
xlabelbase = Widget_Base(tlb, Row=1)
w_xStart = cw_field(xlabelbase, /text, title='X:', frame=2, valu=0, xsize=6)
w_xDelta= cw_field(xlabelbase, /text, title='dx:', frame=2, valu=0, xsize=6)
ylabelbase = Widget_Base(tlb, Row=1)
w_yStart= cw_field(ylabelbase, /text, title='Y:', frame=2, valu=0, xsize=6)
w_yDelta= cw_field(ylabelbase, /text, title='dy:', frame=2,valu=0, xsize=6)
buttonBase = Widget_Base(tlb, column=3, /align_center, /base_align_center)
cancelID = Widget_Button(buttonBase, Value='Cancel', event_pro='userROI_quit')
viewID = Widget_Button(buttonBase, Value='View', event_pro='userROI_view')
acceptID = Widget_Button(buttonBase, Value='Accept', event_pro='userROI_accept')
; Realize the widget hierarchy.
Widget_Control, tlb, /Realize
tvimage1, bytscl(image, smin, smax)
info = { use:0,$
image:image,$
origImage:d.image,$
wid:wid,$
drawID: drawID,$
xstart:w_xStart,$
xdelta:w_xDelta,$
ystart:w_yStart,$
ydelta:w_yDelta,$
xend:-1L,$
yend:-1L}
Widget_Control, tlb, Set_UValue=info, /No_Copy
widget_control, event.top, get_uval=w
w.userROI = tlb
widget_control, event.top, set_uval=w
XManager, 'textbox', tlb
END
When I try to call my userROI data in widget 1, I get:
% WIDGET_CONTROL: Invalid widget identifier: 143.
Do you have any thoughts on this? Where did I go wrong?
Thanks.
|