<?
class frmPrompt extends MForm
{

    public function __construct()
    {   
		parent::__construct('Prompt Controls Examples');
    	$this->eventHandler();
	}
    
	function CreateFields()
	{
		$fields = array(
           new MTextLabel('lblText','','Texto'),
           new MButton('btnError','Error'),
           new MButton('btnInfo','Information'),
           new MButton('btnConf','Confirmation'),
           new MButton('btnQuestion','Question')
        );
        $this->setFields($fields);
        $this->defaultButton = false;
	}

    public function btnError_click()
    {
        global $MIOLO, $module, $self;
        $msg = 'message error';
        $goto = $MIOLO->getActionURL($module,$self);
        $caption = 'error caption';
        // event: method_name;parameter
        $event = "promptHandler;error";
        $MIOLO->error($msg, $goto, $caption, $event);
    }

    public function btnInfo_click()
    {
        global $MIOLO, $module, $self;
        $msg = 'message information';
        $goto = $MIOLO->getActionURL($module,$self);
        $event = "promptHandler;information";
        $MIOLO->information($msg, $goto, $event);
    }

    public function btnConf_click()
    {
        global $MIOLO, $module, $self;
        $msg = 'message confirmation';
        $gotoOk = $MIOLO->getActionURL($module,$self);
        $gotoCancel = $MIOLO->getActionURL($module,$self);
        $eventOk = "promptHandler;Confirmation_Ok";
        $eventCancel = "promptHandler;Confirmation_Cancel";
        $MIOLO->confirmation($msg, $gotoOk, $gotoCancel, $eventOk, $eventCancel);
    }

    public function btnQuestion_click()
    {
        global $MIOLO, $module, $self;
        $msg = 'message question';
        $gotoYes = $MIOLO->getActionURL($module,$self);
        $gotoNo = $MIOLO->getActionURL($module,$self);
        $eventYes = "promptHandler;Question_Yes";
        $eventNo = "promptHandler;Question_No";
        $MIOLO->question($msg, $gotoYes, $gotoNo, $eventYes, $eventNo);
    }

    public function promptHandler($text='')
    {
        $this->setFieldValue('lblText',$text);
    }

}

?>
