7.4 – Popping alert windows

In iGUI you can simply pop alert windows with just a single line of code.

Create a button with variableName “button1″. The following code pops a window with title:”Title” and info :”Some important things or maybe debug info” when button1 is clicked.

public void button1_Click(iGUIButton caller){
    iGUIRoot.alert("Title", "Some important things or maybe debug info");
}
function button1_Click(caller : iGUIButton){
    iGUIRoot.alert("Title", "Some important things or maybe debug info");
}


Alert method returns the popped window. So you can easily modify it.

public void button1_Click(iGUIButton caller){
    iGUIWindow alertWindow = iGUIRoot.alert("Title", "Some important things or maybe debug info");
    alertWindow.setWidth(1);
}
function button1_Click(caller : iGUIButton){
    var alertWindow = iGUIRoot.alert("Title", "Some important things or maybe debug info");
    alertWindow.setWidth(1);
}

You can also add a cancel button and custom functionality both OK and cancel buttons. If you don’t want to bind any methods to one of the buttons, you can easily pass null as the corresponding callback parameter.

public void button1_Click(iGUIButton caller){
    iGUIRoot.alert("Update?", "A new version of iGUI is available. Do you like to install it now?", "No Thanks", null, "Update Now", processUpdate);
}

public void processUpdate(iGUIElement caller){
    //Do some useful update here
    Debug.Log("Processing update...");
}
function button1_Click(caller : iGUIButton){
    iGUIRoot.alert("Update?", "A new version of iGUI is available. Do you like to install it now?", "No Thanks", null, "Update Now", processUpdate);
}

function processUpdate(caller : iGUIElement){
    //Do some useful update here
    Debug.Log("Processing update...");
}