
Missing parenthesis

ferngarcmart
Hi everyone,
I´m having a little problem with my procedure. I want to use a window for calculating a normalization factor for a chosen wave, and then apply this normalization factor to a set of waves, selected in another listbox. I managed to do the first part (SelectNormalizationWave part), but when I use a button for duplicating the waves that I want to normalize(Function B_Continue), I obtain the following message: "expected right parenthesis". I have modify the commands, but I still get the same error. Can somebody help me?. I attach the experiment file in case it is necessary, as well as the procedure itself.
Many thanks.
#pragma rtGlobals=1 Function Panel() NewDataFolder/O root:Parameters NewDataFolder/O root:Waves DFREF Ref=root:Parameters, Refw=root:Waves,Refo=root:Original Dowindow/K Normalization_Panel NewPanel /N=Normalization_Panel /M /W=(15,3,30,12) SetDataFolder root:Original String/G Ref:S_ListOfWaves; SVAR S_ListOfWaves=Ref:S_ListOfWaves S_ListOfWaves =WaveList("*",";","") Make/T/O/N=(ItemsInList(S_ListOfWaves, ";")) Ref:W_ListOfWaves/WAVE=W_ListOfWaves; W_ListOfWaves = StringFromList(p, S_ListOfWaves, ";") Make/O/N=(DimSize(Ref:W_ListOfWaves, 0)) Ref:W_WaveSelection/WAVE=W_WaveSelection SetDataFolder root: Variable/G Ref:V_NumberOfWaves;NVAR V_NumberOfWaves=Ref:V_NumberOfWaves V_NumberOfWaves= (DimSize(Ref:W_ListOfWaves, 0)) SetVariable NumberOfWaves title="NumberOfWaves",noedit=1,size={130,20},bodyWidth=60,pos={320,200},limits={-inf,inf,0}, value=V_NumberOfWaves, win=Normalization_Panel TitleBox Range_Tittle pos={100,200},title="Range",frame=1, win=Normalization_Panel TitleBox WavesToNormalize pos={380,20}, title="WavesToNormalize", frame=1, win=Normalization_Panel TitleBox WaveBase_Tittle pos={100,20},title="WaveBase",frame=1, win=Normalization_Panel Variable/G Ref:V_RangeInitial; NVAR V_RangeInitial=Ref:V_RangeInitial SetVariable Range_From title="\\JLFrom",bodyWidth=60,highColor= (0,0,0), value=V_RangeInitial SetVariable Range_From lowColor= (0,0,0),frame=2,font="default" SetVariable Range_From pos={50,250} SetVariable Range_From bodyWidth=40,limits={-inf,inf,0} Variable/G Ref:V_RangeFinal; NVAR V_RangeFinal=Ref:V_RangeFinal; V_RangeFinal=50 SetVariable SV_RangeTo title="\\JLTo",bodyWidth=60,highColor= (0,0,0), value=V_RangeFinal SetVariable SV_RangeTo lowColor= (0,0,0),frame=2,font="default" SetVariable SV_RangeTo pos={150,250} SetVariable SV_RangeTo bodyWidth=40, limits={-inf,inf,0} GroupBox GB_NormSep pos={30,180},size={500,4},frame=0, win=Normalization_Panel Variable/G ref:V_NormalizationIntensity; NVAR V_NormalizationIntensity=ref:V_NormalizationIntensity SetVariable ST_Intensity pos={400,260}, title="Intensity", bodyWidth=60, limits={-inf,inf,0},win=Normalization_Panel, value=V_NormalizationIntensity,noedit=1 ListBox LB_NormalizationWave pos={90,60}, size={80,80}, listWave=W_ListOfWaves, selWave=W_WaveSelection, mode=1, win=Normalization_Panel, proc=SelectNormalizationWave ListBox LB_WavesToNormalize pos={390,60},size={80,80}, listWave=W_ListOfWaves, selWave=W_WaveSelection, mode=4, win=Normalization_Panel, noproc Button B_Continue pos={150,290}, title="Continue", proc = B_Continue, win=Normalization_Panel end Function SelectNormalizationWave(snw) STRUCT WMListboxAction &snw DFREF Ref=root:Parameters, Refw=root:Waves,Refo=root:Original if (snw.eventCode == 4) // CellSelection NVAR V_RangeInitial=Ref:V_RangeInitial, V_RangeFinal=Ref:V_RangeFinal,V_NormalizationIntensity=ref:V_NormalizationIntensity SVAR S_ListOfWaves=Ref:S_ListOfWaves Variable/G Ref:V_NormalizationRow; NVAR V_NormalizationRow=Ref:V_NormalizationRow ControlInfo /W=Normalization_Panel LB_NormalizationWave V_NormalizationRow = V_Value String/G Ref:S_NormalizationWave; SVAR S_NormalizationWave=Ref:S_NormalizationWave S_NormalizationWave=StringFromList(V_NormalizationRow, S_ListOfWaves , ";") Duplicate/O refo:$S_NormalizationWave, refw:W_Normalization/WAVE=W_Normalization Make/O/N=(DimSize(W_Normalization, 0)) refw:Normalization/WAVE=Normalization Normalization=W_Normalization; Integrate Normalization V_NormalizationIntensity=(Normalization[DimSize(W_Normalization,0)-V_RangeInitial]-Normalization[DimSize(W_Normalization,0)-V_RangeFinal])/(V_RangeFinal-V_RangeInitial) Endif End Function B_Continue() DFREF Ref=root:Parameters, Refw=root:Waves,Refo=root:Original NVAR V_RangeInitial=Ref:V_RangeInitial, V_RangeFinal=Ref:V_RangeFinal SVAR S_ListOfWaves=Ref:S_ListOfWaves WAVE W_WaveSelection=Ref:W_WaveSelection WAVE W_ListOfWaves=Ref:W_ListOfWaves Variable/G Ref:V_Point; NVAR V_Point=Ref:V_Point; V_Point=0 Variable/G Ref:V_Number; NVAR V_Number=Ref:V_Number; V_Number=0 String/G Ref:S_wave; SVAR S_wave=Ref:S_wave; S_Wave="Ups" if (W_WaveSelection[V_Point] == 1) S_wave=StringFromList(V_Point, S_ListOfWaves) Duplicate/O Refo:$S_wave, Refw:$("W_Wave" + num2str(V_Number)) V_Number +=1; V_Point +=1 else V_Point+=1 Endif End
January 10, 2018 at 08:07 am - Permalink
Yep, that was the problem. I changed that and now it works.
Thank you very much.
January 11, 2018 at 02:06 am - Permalink
This illustrates a very common misunderstanding- the form of a control action procedure must be *exactly* as shown in the documentation. That's because when something happens to a control that requires calling your procedure, Igor must put together a call to the action procedure. If you write a procedure with a different format, Igor doesn't know how to fill out the unknown parameters.
You might think that an action proc that simply has no inputs would be OK. I suppose it could be, but it would have to be written in Igor's source as a special case. That adds complexity and complexity adds the chance for bugs, so we avoid it when we don't think the added complexity adds significant additional functionality.
John Weeks
WaveMetrics, Inc.
support@wavemetrics.com
January 11, 2018 at 09:33 am - Permalink