PDA

View Full Version : Wset error with WwMainwindow



green12
09-21-2009, 04:21 PM
I have successfully opened a Wwdrawing widget in a Wwmainwindow with a window ID=1. Yet when I try to plot to wset,1 (from another function) I get an error stating "WSET: Window is closed and unavailable."

WwMainWindow code:

PRO APSelectGUI,bcl, movie
print, bcl
common guiids, main, main2
common APids, value,j, APdraw

main2=WwMainWindow(main,mainLayout,/Vertical, Title = 'Ap Selection')
APdraw=WwDrawing(mainLayout, 2, 'DrawCB', [256,256], [512,512], /Noscroll)
controls=Wwlayout(mainLayout,/horizontal)
btnAccept=WwButtonBox(controls,'Accept', 'buttonAcceptCB', border=0)
btnDelete=WwButtonBox(controls,'Delete', 'buttonDeleteCB', border=0)
btnFinish=WwButtonBox(controls,'Finish', 'buttonFinishCB', border=0)

status=WwSetValue(main2, /Display)
END

plotting function

PRO startBtnCB, wid, data
common ids2, fArray
common guiids, main, main2, apdraw2
common APids, value,j, APdraw

;????value = WwGetValue(wid)

;Assuing all incoming files have the same x & y spatial dimensions
;need file path array and numbfile
; assume there is an even number of steady state stimuli

s=SIZE(fArray)
numbFiles= s(2)
BCLValues=FLTARR(numbFiles,2)


;STEADY-STATE CALCULATIONS

;status=WwGetValue(steadstate, ssStart, ssEnd)....
ssStart=1
ssEnd=10
;GET ALL INFOR FROM main GYUI

;FOR z=0, numbFiles-1 DO BEGIN
z=0
movie=READVAR(fArray(0,0)+fArray(1,0), /sr, mvinf=inf)
x=inf(0)
y=inf(1)
totalFrames=inf(2)
frameRate=inf(4)


movie=REFINEMOVIE(movie) ;takes away mysterious inital offset

BCL=GETBCL(movie, frameRate, ssStart,ssEnd)
BCLvalues(z,0)=BCL(0)
BCLvalues(z,1)=BCL(1)

APSELECTGUI, bcl(0), movie
WSET,1
PLOT, movie(30,30,0:(2*BCL(0)))
;goodSSTraces=SelectAPs(movie, bcl(0), ssStart, ssEnd)
;ENDFOR

END

any ideas. THANKS!

green12
09-21-2009, 04:22 PM
there is a typo here the wwdrawing id should be a value of 1 not 2. still dont work.

acg
09-22-2009, 12:17 PM
This looks like a timing issue. I suggest the following changes:

PRO APSelectGUI,bcl, movie
...
...

status = WwSetValue(main2, /Display)
status = WtProcessEvent(/Drain)

END


PRO startBtnCB, wid, data
...
...
APSELECTGUI, bcl(0), movie
IF !D.window NE 1 THEN WSET, 1
...
...
END