SimpleDialog Example

SimpleDialog is an implementation of Panel that behaves like an OS dialog. SimpleDialog is used for asking the user a simple question that usually involves a Yes/No or OK/Cancel response.

The code to instantiate this SimpleDialog example looks like this: dlg = new YAHOO.widget.SimpleDialog("dlg", { width: "20em", effect:{effect:YAHOO.widget.ContainerEffect.FADE,duration:0.25}, fixedcenter:true, modal:true, draggable:false });

YAHOO.example.simpledialog.dlg.setHeader("Warning!");
YAHOO.example.simpledialog.dlg.setBody("Are you sure you want to do this?");
YAHOO.example.simpledialog.dlg.cfg.setProperty("icon",YAHOO.widget.SimpleDialog.ICON_WARN);
Next, we wire up the buttons using a simple JSON structure that points to local handlers for each button: dlg.cfg.setProperty("buttons", [ { text:"OK", handler:handleOK, isDefault:true }, { text:"Cancel",handler:handleCancel } ] );