View Single Post
  #9  
Old 04-05-2007, 10:57 PM
Inverness Inverness is offline
Incubator
Inverness's Avatar
Join Date: Aug 2004
Location: Houston, Texas
Posts: 3,613
Inverness is a jewel in the roughInverness is a jewel in the rough
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();
} 
__________________
Reply With Quote