2 Set Variable Options in One Panel?
Hart43
I've included a copy of the code for generating the panel below, right now I'm not worried about processing or using the variable, I'm just trying to figure out how to make igor recognize that both PIDmin and minLMEnergy should be variables that I can adjust through the use of the panel.
#pragma rtGlobals=3 // Use modern global access method and strict wave access.
Function InitLiqScinGlobals()
Variable/G PIDmin, minLMEnergy
End
Window LiqScin_NeuGam() : Panel
Variable xOff, yOff
PauseUpdate; Silent 1 // building window...
DoWindow/K LiqScin_NeuGam
NewPanel/K=1 /W=(521,60,910,200) as "LiqScin_NeuGam"
SetDrawLayer UserBack
SetDrawEnv fname= "Trebuchet MS",fsize= 16,fstyle= 1
DrawText 20,30,"Liquid Scintillator Neutron/Gamma Separation"
SetDrawEnv fname= "Trebuchet MS"
xOff=30; yOff = 60
GroupBox LS_ANA pos={xOff-10,yOff-30}, size={350,90 }, title="Analysis",fsize= 12,fstyle= 1
SetVariable LS_EGT,pos={xOff+200,yOff+5},size={120,21},bodywidth=50,title="LM_Energy >"
SetVariable LS_EGT,help={"Adjust low-energy cut in the analysis"}
SetVariable LS_EGT,font="Trebuchet MS",fSize=12,limits={0,inf,0},value=minLMEnergy
SetVariable LS_PID,pos={xOff+200,yOff+30},size={120,21},bodywidth=50,title="PID_Minimum >"
SetVariable LS_PID,help={"Adjust PID cut in the analysis for neutron/gamma separation"}
SetVariable LS_PID,font="Trebuchet MS",fSize=12,limits={0,inf,0},value=PIDmin
End
Function InitLiqScinGlobals()
Variable/G PIDmin, minLMEnergy
End
Window LiqScin_NeuGam() : Panel
Variable xOff, yOff
PauseUpdate; Silent 1 // building window...
DoWindow/K LiqScin_NeuGam
NewPanel/K=1 /W=(521,60,910,200) as "LiqScin_NeuGam"
SetDrawLayer UserBack
SetDrawEnv fname= "Trebuchet MS",fsize= 16,fstyle= 1
DrawText 20,30,"Liquid Scintillator Neutron/Gamma Separation"
SetDrawEnv fname= "Trebuchet MS"
xOff=30; yOff = 60
GroupBox LS_ANA pos={xOff-10,yOff-30}, size={350,90 }, title="Analysis",fsize= 12,fstyle= 1
SetVariable LS_EGT,pos={xOff+200,yOff+5},size={120,21},bodywidth=50,title="LM_Energy >"
SetVariable LS_EGT,help={"Adjust low-energy cut in the analysis"}
SetVariable LS_EGT,font="Trebuchet MS",fSize=12,limits={0,inf,0},value=minLMEnergy
SetVariable LS_PID,pos={xOff+200,yOff+30},size={120,21},bodywidth=50,title="PID_Minimum >"
SetVariable LS_PID,help={"Adjust PID cut in the analysis for neutron/gamma separation"}
SetVariable LS_PID,font="Trebuchet MS",fSize=12,limits={0,inf,0},value=PIDmin
End
Thanks in advance for any help or advice.
Method 1 - Global Variables
* create a global variable call minLMEnergy
* link the setvariable to that global (easiest method is to double click the setvariable control in edit mode and set the variable)
Method 2 - Local Variable
* define the set variable to hold value=_NUM (check the syntax please!!!)
* read the setvariable with ControlInfo when you need to get the value
--
J. J. Weimer
Chemistry / Chemical & Materials Engineering, UAHuntsville
December 5, 2014 at 03:15 pm - Permalink
The global variable I want to create is actually PIDmin. For some reason the procedure isn't recognizing:
It seems to be creating the minLMEnergy variable, and when I open edit mode for the panel, the value is set to minLMEngergy.
The problem stems from trying to select PIDmin as a value for PID_Minimum in the setvariable control. I used the Variable/G command to create the PIDmin variable in the procedure, but when trying to select this as the value in the setvariable control, it isn't shown on the list of possible options.
December 6, 2014 at 02:51 pm - Permalink
Two possibilities:
1. The global variable does not exist because the Variable/G command was never executed.
Putting the command in a procedure does not create the global variable. You can execute it from a procedure or from the command to create the global variable. Execute Variable/G command from the command line to create it.
2. The global variable exists but is in a data folder other than the current data folder.
December 6, 2014 at 03:36 pm - Permalink
Thank you hrod, I know you've answered several of my questions already and I appreciate the help here as well. I thought I had used the execute command but it seems this was not the case. Entering it via the command line fixed the problem.
December 6, 2014 at 04:55 pm - Permalink