import System;
import System.Windows.Forms;
import System.Drawing;

var f : MyForm = new MyForm();
f.ShowDialog();

class MyForm extends Form {
	var text1 : TextBox;
	var btn1 : MyButton;
	var btn2 : MyButton;
	var btn3 : MyButton;
	var btn4 : MyButton;
	function MyForm() {
		super();
		Size = new System.Drawing.Size(200, 150);
		Location = new Point(200, 50);
		StartPosition = FormStartPosition.Manual;
		text1 = new TextBox();
		text1.Size = new System.Drawing.Size(180, 60);
		text1.Left = 5;
		text1.Multiline = true;
		Controls.Add(text1);
		btn1 = new MyButton();
		btn1.Text = "Cut";
		btn1.Location = new Point(10, 65);
		Controls.Add(btn1);
		btn2 = new MyButton();
		btn2.Text = "Copy";
		btn2.Location = new Point(100, 65);
		Controls.Add(btn2);
		btn3 = new MyButton();
		btn3.Text = "Paste";
		btn3.Location = new Point(10, 95);
		Controls.Add(btn3);
		btn4 = new MyButton();
		btn4.Text = "Clear";
		btn4.Location = new Point(100, 95);
		Controls.Add(btn4);
	}
}

class MyButton extends Button {
	protected override function OnClick(e : EventArgs) {
		var t : TextBox = MyForm(Parent).text1;
		if(Text == "Cut")
			t.Cut();
		else if(Text == "Copy")
			t.Copy();
		else if(Text == "Paste")
			t.Paste();
		else
			t.Clear();
	}
}
