Simple control panel/function example needed

Ive got a big function (makes synthetic sub-diffraction micrograph data if anybody is interested) that takes a list of parameters as inputs. I've made a short GUI with those parameters attached to (noproc) SetVariable controls. It loads and everything looks nice, with titles, proper spacing, initial values, limits, and all that jazz. Im trying to add a button now to make it all go, but Im having a hard time finding some clear and simple examples of how to tie it all together. Ive read the manual pdf's multiple times, but I have to admit I get very confused without simple examples.

So basically instead of typing datasynthesis(param1,param2,param3,...) I would like to type GUI() --> set variables via controls --> push go button --> start datasynthesis()
Can anybody help me with that? Just a bare-bones simplified example showing proper syntax would be awesome.

On a side note, I read that you can avoid global variables (thats good, yeah?) by using the value=_NUM:<> or _STR:<> flags, instead of value=variable_name and calling that variable as global. If you do this, should the control name then be the variable name? It doesnt really give any examples here..
To utilize a button to start the calculation, tie the button to a function. Inside this function, you will get the values of your setvariables and then call the calculation function.

function buttonproc(CtrlName): ButtonControl
   string CtrlName
 
   controlinfo setvariable1                        //Get parameters
   variable param1 = v_value

   controlinfo setvariable2
   variable param2 = v_value
   .
   .
   .

   datasynthesis(param1, param2, param3,...)    //call function
end


The structure of a function for a button is outlined in the manual, in addition to the controlinfo command which will retrieve the values of your setvariables. From the description of what you want, these two things should be all that you need.
Thanks a million. It was staring me in the face, but sometimes its the little things, you know..

So I used the above in conjunction with this line
SetVariable/Z setvar_base_name win=controlWin, activate,bodyWidth=100,noproc, fsize = 16,size={230,100},pos={20,480}, title="Base File Name" ,value=_STR:"default"

and for some reason, I have to click on the field before I push the button, or the program fails due to a null string. This is even tho the string value is stored as "default". Is that normal behavior? It doesnt happen with the other setvariable fields containing numerical values instead of strings. In this case, I am not even using the string as of yet, it doesnt even get passed to the main program. I am using s_value not v_value, of course. Also, Im not sure what exactly "activate" does, I put that in there to see if it would fix the problem, no difference noted..
daggaz wrote:

So I used the above in conjunction with this line
SetVariable/Z setvar_base_name win=controlWin, activate,bodyWidth=100,noproc, fsize = 16,size={230,100},pos={20,480}, title="Base File Name" ,value=_STR:"default"
..


This (re)sets the SetVariable value on the control panel in the same function that is supposed to read the values. Why are you needing to do this? Unless I misunderstand something, you would be better to set all the setvariable values before the user hits the control button that is to activate the calculation function. Then, within that DoIt button procedure, you can just read the setvariable inputs with ControlInfo calls.

daggaz wrote:
Also, Im not sure what exactly "activate" does, I put that in there to see if it would fix the problem, no difference noted..


The "activate" call causes the field to be brought forward for direct input. That is one reason why you have to click on it.

--
J. J. Weimer
Chemistry / Chemical & Materials Engineering, UAHuntsville
Sorry, I meant I put that line in when I defined the setvariable initially, then I use the code that was shown for retrieving the values in the next function. I'll go ahead and pull those action flags then, but I was getting this problem before I put them in.
After you initially create the setvariables, you should never have to use SetVariable in your code again. This should only be done if you wish to change the appearance of the control or to programmatically change the value.

From your description of your desired result, this shouldn't be required in your code. Simply use the ControlInfo command to retrieve the value that was entered by the user. Also, I generally avoid using Active
I only use setvariable once, to create the control and initialize the value. I included that line so people could see how I did that, I didnt mean that I used that line again, and certainly not after the parameter is retrieved.

But thanks again for the example. It works fine except for a little wierdness which I am sure is something I am doing..