Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Current »

Introduction

Promptbox is a programatic only component in XUL. Meaning you cannot add it to the XUL doc. It's included for the sake of maintaining UI neutral code.

Properties

Property

Fires Events

Possible Values

Notes

message (String)

No

 

 

title (String)

No

 

 

value (String)

No

 

The value in the textbox. Used to get the user entered value or set the default

acceptLabel (String)

No

 

 

cancelLabel (String)

No

 

 

height (int)

No

 

 

width (int)

No

 

 

icon (String)

No

 

 

message (String)

No

 

 

title (String)

No

 

 

scrollable (bool)

No

 

 

Methods

open() - Blocks in the case of Swing and SWT, but not in GWT. Hence the addition of the XulDialogCallback.
addDialogCallback(XulDialogCallback)
removeDialogCallback(XulDialogCallback)
setModalParent(Object parent) - used to properly parent the dialog.

Sample Usage

XulPromptBox prompt = (XulPromptBox) document.createElementById("promptbox");
prompt.setTitle("User Entry Required");
prompt.setMessage("Supply a new value:");
prompt.addDialogCallback(new XulDialogCallback(){
 enum Status{
   ACCEPT,
   CANCEL,
   ONEXTRA1,
   ONEXTRA2
 }
  public void onClose(XulComponent sender, Status returnCode, Object retVal){
    switch(returnCode){
     case ACCEPT:
       setNewValue(((XulPromptBox) sender).getValue());
       break;
     case CANCEL:
       //Do nothing
       break;
    }
  }
  public void onError(XulComponent sender, Throwable t){

  }
});
prompt.open();
  • No labels