Seperating GUI.Changed for Toolbar and Toggles

I’m trying to program up a menu in which clicking different buttons of a GUI.Toolbar reveal different submenus consisting of GUI.Toggles. Clicking the toolbar button again hides the toggles.

The problem is that I’m using GUI.changed to detect whether a toolbar button has been pressed, but pushing toggles also sets GUI.changed == true.

How can I seperate these two actions?

Could use your own global, which replaces GUI.changed:

subMenuType=-1; // open submenu (0-5). -1 means all are closed.

void OnGUI() {
  // Main menu bottons "turn on" submenus by setting var:
  if(GUI.Button( showSubMenu0 )) { subMenuType=0; }
  if(GUI.Button( showSubMenu1 )) { subMenuType=1; }
  // if you are super-cool, also set some sort of frameCount var,
  //   used to fade submenus in or something

  if(subMenuType==0) { // checking our new subMenu var
     ...
    if( GUI.Button( subM0ActionX )) {
       Do actionX stuff
       subMenuType=-1; // close submenu after an action 
    }
  } // submenu0

}