Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado
I figured I would start with something easy,&nbsp;trying to create widget that displays images in&nbsp;Widget_Draw.&nbsp; I am trying to pass the wdraw variable in&nbsp;a Struct to the button procedure event handler. The&nbsp;event handler then calls a procedure that will hopefully open the file, resize the image and display in the wdraw window. Right now I am getting an error saying that my wdraw variable is undefined. Some hints to what I am doing wrong, would be greatly appreciated! &nbsp; Widget_Draw creation ***** &nbsp;wdraw = Widget_Draw(wbase_col, XSize=256, YSize=256,$ &nbsp; &nbsp;&nbsp;Graphics_Level=2, Expose_Events=1, Retain=0, $ &nbsp;&nbsp;&nbsp;Event_Func ='image_expose') **** &nbsp; Creating&nbsp;the Struct **** info = { &nbsp;wdraw:wdraw,$ &nbsp;&nbsp;&nbsp; &nbsp;wid:wid } Widget_Control, wbase, Set_UValue=info, /No_Copy ***** &nbsp; The button event handler code ***** Widget_Control, event.top, Get_UValue=info, /No_Copy &nbsp;&nbsp;selectFile, info.wdraw &nbsp;Widget_Control, info.wdraw, Set_UValue=info, /No_Copy ***** &nbsp; The file select procedure relating to the finding the Draw Widget ***** Widget_Control, wdraw, Get_Value=wid, /No_Copy oldWin = !D.WINDOW WSET, wid &nbsp;loadct, 0, /SILENT erase,wid ***** &nbsp; &nbsp; Thanks, Logan Lindquist <A href="mailto:llindquist@mrdoc.cc">llindquist@mrdoc.cc &nbsp; &nbsp;
How do I get the image to stay in the Widget_Draw when I click on another window? I was thinking that by&nbsp;coding in the PRO that the Widget_Draw calls [in the initialization], something&nbsp;updates the image. Is this the correct way to do that? &nbsp; Thanks, &nbsp; Logan
In the event handler, get the value of the draw widget and set that to be the active window: widget_control, Draw_ID, get_value=w_ID wset, w_ID You can also make the event handler return the focus to the originally active direct graphics window. Check out http://spot.colorado.edu/~romashki/idl/smart_w.pro to see how the window focusing can be accomplished. > Logan Lindquist wrote: > > How do I get the image to stay in the Widget_Draw when I click on > another window? I was thinking that by coding in the PRO that the > Widget_Draw calls [in the initialization], something updates the > image. Is this the correct way to do that? > > Thanks, > > Logan