Help with Displaying Results of Curvefit during a loop

Hi all,
I feel dumb. I wrote this program a few years ago at this point, but have been away from igor programming for a good while.

Anyway, I have the following loop in my program.

<br />
                     do<br />
                        FindValue /V=(w_wnNm[falsePeakPt]-winDiam/wMod) /T=3 w_wnNm<br />
                        leftLocPt2 = V_value                                        //Curvefit window variables<br />
                        FindValue /V=(w_wnNm[falsePeakPt]+winDiam/wMod) /T=3 w_wnNm<br />
                        rightLocPt2 = V_value<br />
            <br />
                        CurveFit/Q/N/W=2/NTHR=0 gauss  kwCWave=coeffWave 'w_wiNm'[rightLocPt2,leftLocPt2] /X='w_wnNm' /D/C=T_Constraints<br />
        <br />
                        Wave W_sigma                                                //Curvefit with constraints, w_sigma used for error checking<br />
                        if (((coeffWave[1] < 0) || (W_sigma[0] > 9999)|| (W_sigma[1] > 9999)|| (W_sigma[2] > 9999)) && (wMod < 15))<br />
                            wMod += 0.5                                             //If height < 0 or any standard deviation parameter are REALLY high, redo fit making the window smaller<br />
                        elseif (wMod > 15)<br />
                            wMod = 1.5                                              //If the window gets too small, expand window to widest and try again.<br />
                        else<br />
                            fitDone = 1                                             //If nothing is wrong, set variable to break loop.<br />
                        endif<br />
                        //Print "THINKING",wMod<br />
                    while (fitDone == 0)<br />


Apologies for the lack of indentation, the copy and pasting seemed to ruin it. Here's what this loop does in words.

1. Find left and right point for the "bounds" of the fit.
2. Does the fit.
3. Does error checking. (Are any of the fit coefficient variables WAY too big or WAY too small?)
3.1 If fit variables ARE wrong, change wMod which will affect the position of the fit "window."
3.2 If fit variables are OK, go on to the next fit. (This fit runs on 100s of graphs.)


Basically what I want to do is display the waves I'm doing the fit on, w_wiNm and w_wnNm, then display the fit once it reaches the "fitDone=1" part. Right before it moves on outside the while loop. Then I want to have a window with an OK button on it saying "Is this fit OK." Heck, I'd settle for a DoPrompt window. I looked at the pauseforuser tutorial, but I didn't want the button on the control panel to call a function, I wanted it to simply continue with the program. Even if I do something like this... it's still not great.

<br />
                        Display/N=TEMPP w_wiNm vs w_wnNm<br />
                        CurveFit/W=1/NTHR=0 gauss  kwCWave=coeffWave 'w_wiNm'[rightLocPt2,leftLocPt2] /X='w_wnNm' /D/C=T_Constraints<br />
                        Pauseforuser TEMPP<br />


The manual says that the program will only continue once the "main window" is killed. But when I run the above, everything freezes. Sure, I can interact with the window named "TEMPP", but I can't kill it. It won't let me. And I can't do anything else in the program. If I could kill the window, it'd be fine, because that could act as my "OK" button (figuratively.)

Any help?
The usual thing with PauseForUser is to have an OK button in the panel that you have designated as the main window. That button's action procedure will kill the window using KillWindow. Yeah, it feels weird to have a button that causes the window to commit suicide, but it works.

John Weeks
WaveMetrics, Inc.
support@wavemetrics.com
So did you try the DoPrompt variant? You just need something to prompt for, it doesn't even have to be all that useful. Something simple like this may do just fine:
    String select
    Prompt select,"Is this fit good enough?",popup,"yup;nah, keep going"
    DoPrompt "what to do next", select
    if (!V_Flag && StringMatch(select,"yup"))
        fitDone = 1
    endif