GUI 1 - From Sound Design
From Sound Design

Windows

	SCWindow("my first window", Rect(100, 800, 400, 450)).front;
	SCWindow("my first window", Rect(100, 800, 400, 450)).front.alpha_(0.1)

Buttons

	(  //double click here
	var myWindow, myButton;
	myWindow = SCWindow.new; // make the window and assign it to a handy variable we can use later
	myWindow.front;  // bring the window into existence  (the 'front')
	
	myButton = SCButton(myWindow, Rect(20,20,340,30) ); // create the button with the dimensions of Rect
	
	myButton.states = [ 			//we assign some states to the button							
				["go on... click here", Color.white, Color.black], // the name, font color, background color
				["oooops !!!", Color.red, Color.yellow], 
				["this computer will autodestroy in 5 secs", Color.blue, Color.red]
	
			  ];
	
	myButton.action = { arg hal; hal.value.postln;}; // every time you click, show what value is being sent.
	)	

________________________________________________________________________
________________________________________________________________________

	SynthDef.new(\sinus, { Out.ar(0, SinOsc.ar(261));} ).send(Server.default);
	x = Synth(\sinus); 
	x.free; 
	
________________________________________________________________________
________________________________________________________________________

	(  
	var  resultingSound, myWindow, myButton;  
	myWindow = SCWindow.new; 
	myWindow.front; 
	
	myButton = SCButton(myWindow, Rect(20,20,340,30) ); 
	myButton.states = [ 								
				["load the Synth", Color.white, Color.black], //state 0
				["make it play", Color.red, Color.yellow], //state 1
				["switch it off", Color.blue, Color.red] // state 2
			  ];
	
	myButton.action = { var buttonState, mySynth ;                     
	                  mySynth = SynthDef.new(\sinus, { Out.ar(0, SinOsc.ar(261));} ); //put the synthdef in a variable
	                  buttonState = myButton.value; // we are assigning here the value sent by the button

	                  case   //an explanation of this will follow below !
	                  { buttonState == 1 }  { mySynth.send(Server.internal) }  // send the Synthdef when the state sent is 1
	                  { buttonState == 2 }  { resultingSound = Synth(\sinus).postln } // play it when the state sent is 2
	                  { buttonState == 0 }  { resultingSound.free };  // switch it off when the state sent is 0
			    };
	)	

________________________________________________________________________
________________________________________________________________________

Sliders

	(  
	var myWindow, mySlider;
	myWindow = SCWindow.new; // make the window and assign it to a variable
	myWindow.front;  // bring the window into existence
	
	mySlider = SCSlider(myWindow, Rect(20,20,340,30) ); // create the slider with the dimensions of Rect
	)

( 
var myWindow, mySlider;
myWindow = SCWindow.new;
myWindow.front;

mySlider = SCSlider(myWindow, Rect(20,20,340,30) ); 

mySlider.action ={
				mySlider.value.postln;   //this will just post the value of the slider for you to see
				};
)

SynthDef.new(\sinus, { arg myFreq = 0; Out.ar(0, SinOsc.ar(myFreq));} ).send(Server.local);
Synth(\sinus, ["myFreq" , 261]);

( 
var myWindow, mySlider, mySynth, resultingSound ;  
Server.local = s = Server.default;
myWindow = SCWindow.new; 
myWindow.front;  
mySlider = SCSlider(myWindow, Rect(20,20,340,30) ); 
mySynth = SynthDef.new(\sinus, { arg myFreq = 0; Out.ar(0, SinOsc.ar(myFreq));} ).send(Server.local);
resultingSound = Synth(\sinus);

mySlider.action = {var sliderValue;
				sliderValue = (mySlider.value*20000);   //post the value of the slider
				resultingSound.set("myFreq" , sliderValue);  //the method set passess the values to the synth
				};
)

( 
//declare variables
var  resultingSound, myWindow, myButton, mySlider, mySynth; 
Server.local = s = Server.default; // set the server
myWindow = SCWindow.new; //make the window
myWindow.front;  
mySynth = SynthDef.new(\sinus, { arg myFreq = 0; Out.ar(0, SinOsc.ar(myFreq));} );  //make the synth

//make the button, states and actions.
myButton = SCButton(myWindow, Rect(20,20,340,30) ); 
myButton.states = [ 								
			["load the Synth", Color.white, Color.black], 			["make it play", Color.red, Color.yellow], 
			["switch it off", Color.blue, Color.red] 
				 ];
myButton.action = { var buttonState ;   
                                          
                  buttonState = myButton.value.postln; 
                  case   
                  { buttonState == 1 }  { mySynth.send(Server.internal) }  // load the synth
                  { buttonState == 2 }  { resultingSound = Synth(\sinus).postln } // make it play
                  { buttonState == 0 }  { resultingSound.free };  // turn it off		    };

//make the slider, 
mySlider = SCSlider(myWindow, Rect(20,100,340,30) ); 

mySlider.action = {var sliderValue;
				sliderValue = (mySlider.value*20000);   				resultingSound.set("myFreq" , sliderValue); 				};
)