Much thanks. Here is another little script I made after the waitfor() was implemented.
PHP Code:
public function showInputDialog(title, label, defval, waittime) {
temp.out = 0; // Return data
new GuiWindowCtrl("InputDialog") {
this.profile = "GuiWindowProfile";
this.extent = {240,115};
this.position = {
(screenwidth - this.extent[0]) / 2,
(screenheight - this.extent[1]) / 2
};
this.canMaximize = false;
this.canMinimize = false;
this.canResize = false;
this.canClose = false;
this.text = title;
this.visible = true;
new GuiTextCtrl("InputDialog_Label") {
this.profile = "GuiDarkRedTextProfile";
this.position = {30, 30};
this.text = label;
}
new GuiTextEditCtrl("InputDialog_Field") {
this.profile = "GuiTextEditProfile";
this.position = {15, 50};
this.extent = {210, 20};
this.text = defval;
}
new GuiButtonCtrl("InputDialog_Button") {
this.profile = "GuiButtonProfile";
this.position = {90, 75};
this.extent = {60, 25};
this.text = "OK";
}
new GuiButtonCtrl("InputDialog_ButtonCancel") {
this.profile = "GuiButtonProfile";
this.position = {160, 75};
this.extent = {60, 25};
this.text = "Cancel";
}
}
InputDialog.bringToFront();
if (waitfor("InputDialog_Button","onAction",waittime) == true) {
out = InputDialog_Field.text;
InputDialog.destroy();
return out;
}
else {
InputDialog.destroy();
return null;
}
}
public function InputDialog_ButtonCancel.onAction() {
InputDialog_Field.text = "";
InputDialog_Button.performclick();
}