Wandering popup menu

I'm seeing slightly strange behaviour from a popup menu. Whenever I go to the "Analyse CAS" tab and the back to the "Load" tab the popup menu moves slightly. This happens in a Windows XP virtual machine and when running Igor under Wine. Colleagues have also reported this using native Windows installations. Am I doing something really stupid here? I've tried to cut out a lot of the code not related to the problem, so there are a few missing variables in the following excerpt.

#pragma rtGlobals=1     // Use modern global access method.
function CAPS_Proc()
    PauseUpdate; Silent 1       // building window...
    NewPanel /W=(10,60,362,700) /N=CASProc
    SetDrawLayer UserBack
    TabControl capsMainTab disable=0, proc=caps_tab_proc, pos={2,65}, size={346,500}, tabLabel(0)="Load", tabLabel(1)="Analyse CAS", title="MainTab", win=casProc
    caps_tab_proc("tmp",0)
end

function caps_tab_proc(name,tab)
    String name
    Variable tab
    String/G mieProbe = ""
    GroupBox CAPS_Correct_RI_Box,disable=(tab!=0),pos={8,280},size={334,105}
    TitleBox CAPS_RI_Caption,frame=0,fsize=16,pos={75,282},disable=(tab!=0),title="Refractive Index / Diameter"
    SetVariable realRIset,value=realRI,pos={15,305},size={86,18},title="Real",limits={0,10,0},disable=(tab!=0)
    SetVariable imagRIset,value=imagRI,pos={105,305},size={86,18},title="Imag",limits={0,10,0},disable=(tab!=0)
    SetVariable mdminset,value=Dmin,pos={15,325},size={86,18},title="Dmin",limits={0,10,0},disable=(tab!=0)
    SetVariable mdstepset,value=Dstep,pos={105,325},size={86,18},title="Dstep",limits={0,10,0},disable=(tab!=0)
    SetVariable mdmaxset,value=Dmax,pos={200,325},size={86,18},title="Dmax",limits={0,10000,0},disable=(tab!=0)
    PopupMenu mieProbeCtl,bodyWidth=59,value="-;APSD;CAS;PCASP",pos={240,302},proc=probeselectmie,title="Probe",disable=(tab!=0)
    ControlInfo mieProbeCtl
    Button CAPS_Run_Mie,disable=(tab!=0),pos={300,307},size={25,25},proc=RunMieCode,title="Go!"
    if(tab==0)
        SetDrawEnv linefgc=(65535,65535,65535)
        DrawLine 12,350,338,350
    else
        SetDrawEnv linefgc=(52224,52224,52224)
        DrawLine 12,350,338,350
    endif
    SetVariable xdminset,value=xDmin,pos={15,360},size={86,18},title="Dmin",limits={0,10,0},disable=(tab!=0)
    SetVariable xdstepset,value=xDstep,pos={100,360},size={86,18},title="Dstep",limits={0,10,0},disable=(tab!=0)
    SetVariable xdmaxset,value=xDmax,pos={190,360},size={86,18},title="Dmax",limits={0,10000,0},disable=(tab!=0)
    Checkbox /Z useDefDiam disable=(tab!=0),variable=useDefaultDiameters,noproc,title="Default?",pos={280,360}
end
The problem is in the order in which you've specified the parameters to the PopupMenu command, putting the bodywidth parameter before the position.

The best way to create these commands is to set up your panel the way you want it to look, then save the window recreation macro, and paste the saved PopupMenu command into your function.

--Jim Prouty
Software Engineer, WaveMetrics, Inc.
Thanks Jim.

Edit: Just tried changing the offending line to the following:

PopupMenu mieProbeCtl,value="-;APSD;CAS;PCASP",pos={240,302},bodyWidth=59,proc=probeselectmie,title="Probe",disable=(tab!=0)

and still see the same behaviour. Having already manually positioned everything where I want it using "pos=". I'll try making the window recreation macro and report back...

Edit 2: Popup menus seem very sensitive to the order in which seemingly unrelated options are presented, but after a vast amount of mucking about, the following seems to work:

PopupMenu mieProbeCtl,pos={170,302},size={120,220},bodywidth=60,value="-;APSD;CAS;PCASP",proc=probeselectmie,title="Probe",disable=(tab!=0)

Thanks again for the hint Jim.
jdorsey wrote:
Thanks again for the hint Jim.


You're welcome. Note that the order you came up with is almost identically the order used by the window recreation macro.

That's no coincidence.

--Jim Prouty
Software Engineer, WaveMetrics, Inc.