Disable GUI buttons' click function?

Hi

I am currently creating an application where I need Unity for. I have a big list of buttons. The problem is when I scroll down using my finger, and release it. It will sometimes click a button. Can I disable buttons when I detect a touchphase moving?

My buttons script, please scroll down to see the scroll script

private float buttonSizeY;
private float scrollSizeY;

scrollPosition = GUI.BeginScrollView(new Rect(AppManagerScript.GuiPosX1, 0, Screen.width, Screen.height), scrollPosition, new Rect(0, 0, 0, (18 * scrollSizeY))); 
        for (int i = 0; i < 18; i++)
        {
            if (screenX >= 700)
            {
                
              
                buttonSizeY = 130;
                scrollSizeY = 150;
            }
            else
            {
                
                buttonSizeY = 90;
                scrollSizeY = 110;
            }
            
            if (GUI.Button(new Rect(0, scrollSizeY * i, Screen.width -10, buttonSizeY), AppManagerScript.MaintText*))*

{
#region button clicks
if (i == 0)
{
Debug.Log(“Button 1”);
AppManagerScript.SwitchGUI = true;
AppManagerScript.ClickedButton = 0;
}
if (i == 1)
{
Debug.Log(“Button 2”);
AppManagerScript.SwitchGUI = true;
AppManagerScript.ClickedButton = 1;
}
if (i == 2)
{
Debug.Log(“Button 3”);
AppManagerScript.SwitchGUI = true;
AppManagerScript.ClickedButton = 2;
}
if (i == 3)
{
Debug.Log(“Button 4”);
AppManagerScript.SwitchGUI = true;
AppManagerScript.ClickedButton = 3;
}
//etc etc…
#endregion
}
Script for scrolling:
if (Input.touchCount > 0)
{
touch = Input.touches[0];
if (touch.phase == TouchPhase.Moved)
{
if (buttonSizeY > 100)
{//Disable the click function on the gui buttons?
scrollPosition.y += touch.deltaPosition.y * 3.3F;
}
else
{//Disable the click function on the gui buttons?
scrollPosition.y += touch.deltaPosition.y * 1.8F;
}

}
}

You can declare a bool which you set to false when you drag and to true when the phase ends. When clicking, check if that variable is true or not.

This is kinda dirty but you could use the GUI.enabled = false; before the buttons and turn it back to true when you are done scrolling around.

This is how I did it.

 Button loginButton = GameObject.Find("Login").GetComponent<Button>();
                loginButton.enabled = false;