Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Join us on Thursday, June 8, for a Q&A with Unity's Content Pipeline group here on the forum, and on the Unity Discord, and discuss topics around Content Build, Import Workflows, Asset Database, and Addressables!
    Dismiss Notice

[solved]window containing an other window

Discussion in 'Immediate Mode GUI (IMGUI)' started by blackant, Aug 28, 2009.

  1. blackant

    blackant

    Joined:
    Jun 18, 2009
    Posts:
    514
    hello,

    i made a large window with many info, and a button on witch user may clic for connecting to server.
    this button must create a window in witch it must have connection informations

    Code (csharp):
    1.  
    2. void loginWindow (int window)
    3.         {
    4.         GUI.skin = gSkin;  
    5.        
    6.         GUI.Label(new Rect(110, 180 , 60, 20), "nom: ");
    7.         username = GUI.TextField(new Rect(180 , 180, 200, 20), username, 15);
    8.         GUI.Label(new Rect(110, 220, 60, 20), "Password: ");
    9.         password = GUI.TextField(new Rect(180, 220, 200, 20), password, 15);
    10.            
    11.             if  (GUI.Button(new Rect(100, 260, 100,20), "creer un compte"))
    12.                 {
    13.                 Application.OpenURL (urlforum3d);
    14.                 }
    15.            
    16.             if  (GUI.Button( new Rect(210 , 260, 120,20), "j'ai oublié mon pass"))
    17.                 {
    18.                 Application.OpenURL (urlmail);
    19.                 }
    20.                
    21.             if (GUI.Button(new Rect(150, 300, 100, 24), "Connect")  || (Event.current.type == EventType.keyDown  Event.current.character == '\n'))
    22.                 {
    23.                 Rect  connectRect = new Rect (0, 0, 400, 200);
    24.                 connectRect = GUI.Window(0,connectRect, connectWindow,"connection");               
    25.                 print( "ca se connect!!");
    26.                 connectionAttempt = true;
    27.                 smartFox.Connect(serverIP, Convert.ToInt32(serverPort));
    28.  
    29.             }  
    30.         }
    31. void connectWindow (int window)
    32.     {
    33.         GUI.Button (new Rect (10,30, 80,20), "Click Me!");
    34. }
    35.  
    when i clic on button i see info in debug log but no window was created on screen...

    any idea ?
     
  2. blackant

    blackant

    Joined:
    Jun 18, 2009
    Posts:
    514
    solved with a bool that show /ide the window,
    placing all GUI window at the next of GUI fonction