iTween issue creating a gui. menu box

Hi there, I’m having a little problem with creating a gui menu using iTween. I tried to convert an example from the site for a button move as I want the menu box (with buttons) to move from left to right over x distance; a sliding menu if you like.

I get an error: error CS0029: Cannot implicitly convert type void' to bool’

Can’t quite get my head around why this is. I am quite new to this, so may have things a little 'round the wrong way. Any thoughts would be appreciated. Here’s my code so far:

using UnityEngine;
using System.Collections;

public class AnimatingUnityGUI : MonoBehaviour


{
	
	//Selection Grid
	public int selGridInt = -1;
    public string[] selStrings = new string[] {"Grid 1", "Grid 2", "Grid 3", "Grid 4", "Grid 5", "Grid 6", "Grid 7", "Grid 8", "Grid 9"};
	
	//Counts sells
	private int lastSel = -1;
	
	//LeftNav GUI skin reference
	public GUISkin leftnav;
	
	//Objects
	public GameObject Object1;
	public GameObject Object2;
	
	//Box size and state
	public bool boxRectState = false;	
	public Rect boxRect = new Rect(-5,14,100,800); //holds actual button rect coordinates
	public Rect initialPosition = new Rect(0,20,100,55); //holds starting rect coordinates
	public Rect activePosition = new Rect(75,130,100,55); //holds ending rect coordinates
	
	
	void OnGUI()
	{
		
		//GUISkin for Group
		GUI.skin = leftnav;
		
		GUI.BeginGroup(boxRect, "","Box");
		
		///THIS IS THE ERROR LINE//AnimatingUnityGUI.cs(36,17): error CS0029: Cannot implicitly convert type `void' to `bool'///
		if(GUI.BeginGroup(boxRect,"","Box")) 
		{
			
			if(boxRectState)
			{
			iTween.ValueTo(gameObject,iTween.Hash("from",boxRect,"to",initialPosition,"onupdate","MoveBox","easetype","easeinoutback"));	
			}
			else
			{
			iTween.ValueTo(gameObject,iTween.Hash("from",boxRect,"to",activePosition,"onupdate","MoveBox","easetype","easeinoutback"));
			}
			boxRectState = !boxRectState;
			
			
			// Buttons for GUI box
			
			selGridInt = GUI.SelectionGrid(new Rect(14, 25, 100, 800), selGridInt, selStrings, 1);
		
		
			if (selGridInt != lastSel)
			{ 	// selGridInt changed?
        	lastSel = selGridInt; // yes: update lastSel and take appropriate action
		
			 if (selGridInt == 0) 
			{
			GameObject objObject2 = (GameObject)Instantiate(Object2, new Vector3(0,0,0), transform.rotation);
			Destroy (GameObject.FindWithTag("Object1"));
            }

            
			else if (selGridInt == 1)
			{
			GameObject objObject1 = (GameObject)Instantiate(Object1, new Vector3(0,0,0), transform.rotation);
			Destroy (GameObject.FindWithTag("Object2"));
            }
		
			}
		
		}
		
		GUI.EndGroup();
		
	}
	
		void MoveboxRect(Rect newCoordinates){
		boxRect=newCoordinates;
	
	}
}

just to put all in 1 answer:

1.the itween is callin MoveBox onupdate and you function is called MoveboxRect;
2.just change the box to button, try this

using UnityEngine;
using System.Collections;

public class AnimatingUnityGUI : MonoBehaviour


{

    //Selection Grid
    public int selGridInt = -1;
    public string[] selStrings = new string[] {"Grid 1", "Grid 2", "Grid 3", "Grid 4", "Grid 5", "Grid 6", "Grid 7", "Grid 8", "Grid 9"};

    //Counts sells
    private int lastSel = -1;

    //LeftNav GUI skin reference
    public GUISkin leftnav;

    //Objects
    public GameObject Object1;
    public GameObject Object2;

    //Box size and state
    public bool boxRectState = false;  
    public Rect boxRect = new Rect(-5,14,100,800); //holds actual button rect coordinates
    public Rect initialPosition = new Rect(0,20,100,55); //holds starting rect coordinates
    public Rect activePosition = new Rect(75,130,100,55); //holds ending rect coordinates


    void OnGUI()
    {

       //GUISkin for Group
       GUI.skin = leftnav;

       GUI.BeginGroup(boxRect, "","Box");

       ///THIS IS THE ERROR LINE//AnimatingUnityGUI.cs(36,17): error CS0029: Cannot implicitly convert type `void' to `bool'///
       if(GUI.Button(boxRect,"")) 
       {

         if(boxRectState)
         {
         iTween.ValueTo(gameObject,iTween.Hash("from",boxRect,"to",initialPosition,"onupdate","MoveBox","easetype","easeinoutback")); 
         }
         else
         {
         iTween.ValueTo(gameObject,iTween.Hash("from",boxRect,"to",activePosition,"onupdate","MoveBox","easetype","easeinoutback"));
         }
         boxRectState = !boxRectState;
       }

         // Buttons for GUI box

         selGridInt = GUI.SelectionGrid(new Rect(14, 25, 100, 800), selGridInt, selStrings, 1);


         if (selGridInt != lastSel)
         {    // selGridInt changed?
            lastSel = selGridInt; // yes: update lastSel and take appropriate action

          if (selGridInt == 0) 
         {
         GameObject objObject2 = (GameObject)Instantiate(Object2, new Vector3(0,0,0), transform.rotation);
         Destroy (GameObject.FindWithTag("Object1"));
            }


         else if (selGridInt == 1)
         {
         GameObject objObject1 = (GameObject)Instantiate(Object1, new Vector3(0,0,0), transform.rotation);
         Destroy (GameObject.FindWithTag("Object2"));
            }

         }



       GUI.EndGroup();

    }

       void MoveBox (Rect newCoordinates){
       boxRect=newCoordinates;

    }
}

have fun

SFC