Dropdown menu(PopupList)

What happends here is that when there's a left click so the showlist is true.(pop ups)

but the problem is that when I check if there's a left click and showlist is true(in the if statement) so it opens and immeaditely closes(it's a matter of milliseconds), if I change Fire1 to Fire2, it does closes it correctly with the RIGHT click, i want to close it with the LEFT click.

      using UnityEngine;

public class Popup {
  public static bool List (Rect position, ref bool showList, ref int listEntry, GUIContent buttonContent, GUIContent[] listContent,
                             GUIStyle listStyle) {
        return List(position, ref showList, ref listEntry, buttonContent, listContent, "button", "box", listStyle);
    }

    public static bool List (Rect position, ref bool showList, ref int listEntry, GUIContent buttonContent, GUIContent[] listContent,
                             GUIStyle buttonStyle, GUIStyle boxStyle, GUIStyle listStyle) {
        bool done = false;
        if(!showList && Input.GetButton("Fire1")){
                    showList = true;
        }
        else if(Input.GetButton("Fire1") && showList)
        {
            done = true;
        }
        GUI.Label(position, buttonContent, buttonStyle);
        if (showList) {
            Rect listRect = new Rect(40, 58, 95, listStyle.CalcHeight(listContent[0], 10.0f)*listContent.Length);
            GUI.Box(listRect, "", boxStyle);
            listEntry = GUI.SelectionGrid(listRect, listEntry, listContent, 1, listStyle);
        }
        if (done) {
            showList = false;
        }
        return done;
    }
}

It should be else if for the second if (so it doesn't go into it if you toggle it on)

class what i try to use is Standard Assets/Scripts/Popup.cs
Popup list by Eric Haines.

sing UnityEngine;
using System.Collections;
using System.Collections.Generic;

public class Popup {
    static int popupListHash = "PopupList".GetHashCode();
    // Delegate
    public delegate void ListCallBack();
    
    
   
    public static bool List (Rect position, ref bool showList, ref int listEntry, GUIContent buttonContent, object[] list ,
                             GUIStyle listStyle, ListCallBack callBack) {
        
        
        
        return List(position, ref showList, ref listEntry, buttonContent, list, "button", "box", listStyle, callBack);
    }
   
    public static bool List (Rect position, ref bool showList, ref int listEntry, GUIContent buttonContent,  object[] list,
                             GUIStyle buttonStyle, GUIStyle boxStyle, GUIStyle listStyle, ListCallBack callBack) {
        

        int controlID = GUIUtility.GetControlID(popupListHash, FocusType.Passive);
        bool done = false;
        switch (Event.current.GetTypeForControl(controlID)) {
            case EventType.mouseDown:
                if (position.Contains(Event.current.mousePosition)) {
                    GUIUtility.hotControl = controlID;
                    showList = true;
                }
                break;
            case EventType.mouseUp:
                if (showList) {
                    done = true;
                     // Call our delegate method
                callBack();
                }
                break;
        }
       
        GUI.Label(position, buttonContent, buttonStyle);
        if (showList) {
            
            // Get our list of strings
            string[] text = new string[list.Length];
            // convert to string
            for (int i =0; i<list.Length; i++)
            {
                text _= list*.ToString();*_
 _*}*_
 
 _Rect listRect = new Rect(position.x, position.y, position.width, list.Length * 20);_
 _*GUI.Box(listRect, "", boxStyle);*_
 _*listEntry = GUI.SelectionGrid(listRect, listEntry, text, 1, listStyle);*_
 _*}*_
 _*if (done) {*_
 _*showList = false;*_
 _*}*_
 _*return done;*_
 _*}*_
_*}*_
_*`*_
_*`
*_