Aer Interpreter Source
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

41 lines
815 B

class Button {
public callback $OnBeforeClick;
public callback $OnAfterClick;
public string $Name;
public void __construct() {
$this->Name = 'MyButton';
}
public void Click() {
$this->DoBeforeClick();
print('Click!');
$this->DoAfterClick();
}
private void DoBeforeClick() {
if($this->OnBeforeClick) {
callback $event = $this->OnBeforeClick;
$event($this);
}
}
private void DoAfterClick() {
if($this->OnAfterClick) {
callback $event = $this->OnAfterClick;
$event($this);
}
}
}
class Program {
public void main() {
object $MyWidget = new Button();
$MyWidget->OnBeforeClick = void(object $Sender) { print($Sender->Name + ' (Before Click)'); };
$MyWidget->OnAfterClick = void(object $Sender) { print($Sender->Name + ' (After Click)'); };
$MyWidget->Click();
}
}