<?
class frmWindow1 extends MForm
{
//
//  Sample form which will reside inside a window
//
		function __construct() 
		{
			parent::__construct('Dialog Sample - 1');
            $this->eventHandler();
		}

		function createFields()
		{
            $fields = array(
               new MTextField('edtMoney1','','Valor1 '),
               new MTextField('edtMoney2','','Valor2'),
               new MTextField('edtSoma','','Soma'),
            );
            $this->setFields($fields);

			$buttons = array(
				new MButton('btnSum','Somar'),
                // how to create a close button
				new MButton('btnClose','Fechar', $this->getCloseWindow()),
			);
			$this->setButtons($buttons);
		}

        public function sum()
        {
            $money1 = $this->getFieldValue('edtMoney1');
            $money2 = $this->getFieldValue('edtMoney2');
            return $money1 + $money2;
        }

		function btnSum_click()
		{
            $soma = $this->sum();
            $this->setFieldValue('edtSoma', $soma);
		}

}
?>