Buttons in Rects, opening other Rects?

I’m so confused. I’ve spend a couple of days trying to make this work without luck.

I want a Rect window, draggable with a button. Easy enough so far. When clicked, opens/closes another Rect window, but NOT INSIDE itself, if I do this code and use a if(GUI.bu… then it will create the new rect window inside itself, and not externaly. Anyone mind coding this template up, I’ve really been googling around for this.

I’ve managed to do this with buttons not fixed in a rect, but I want both windows to be draggable.

var show1 = true;
var show2 = false;

OnGUI()
  if (show1)
    GUI.Window(..... where id = 1..., DoWindow1)
  if (show2)
    GUI.Window(.... where id = 2 ..., DoWindo2)

DoWindow1(....
{
   if (GUI.Button(.....
     show2 = true;
   GUI.DragWindow();
}

I’ll let you fill in the details

Put GUI.DragWindow (); inside the DoWindow function(s)

Can you tell me why the windows aren’t draggable then?

var show2 = false;

var btnTexture : Texture;

 function OnGUI () 
 {
 

 GUI.Window (1, Rect (110,10,200,200), DoWindow1, "Window1");
 GUI.DragWindow (); //Doesn't work?
 
 if (show2)
 GUI.Window (2, Rect (110,200,200,200), DoWindow2, "Window2");
 
 }
    
      {
 show2 = true;
 }
 
 }
 GUI.DragWindow (); //Doesn't work??
}
 
function DoWindow2 ()
{
if (GUI.Button(Rect(10,10,50,50),btnTexture))
show2 = false;

      
}