[Mono-osx] EventHandling and SWF
Daniel Schmidt
daniel@demix.org
Fri, 15 Apr 2005 20:36:12 +0200
What's about the EventHandling with System Windows Form on OSX ?
it's OSX 10.3.8 and I'm running Mono Version 1.1.6 .
I wrote this sample Currency Converter app but there's no action if the
Button is clicked.
using System;
using System.Drawing;
using System.Windows.Forms;
public class Calculator : Form
{
Button btnCalc;
TextBox textBoxPrinc;
TextBox textBoxRate;
TextBox textBoxInt;
Label labelPrinc;
Label labelRate;
Label labelInt;
public Calculator()
{
this.Text = "Calculator";
this.Size = new Size(200,225);
btnCalc = new Button();
btnCalc.Location = new Point(50,100);
btnCalc.Text = "Berechnen";
btnCalc.Click += new System.EventHandler(this.onBtnCalcClicked);
this.Controls.Add(btnCalc);
textBoxPrinc = new TextBox();
textBoxPrinc.Location = new Point(10,20);
textBoxPrinc.Size = new Size(150,15);
textBoxPrinc.Text = "1000000.00";
this.Controls.Add(textBoxPrinc);
textBoxRate = new TextBox();
textBoxRate.Location = new Point(10,60);
textBoxRate.Size = new Size(150,15);
textBoxRate.Text = "0.15";
this.Controls.Add(textBoxRate);
textBoxInt = new TextBox();
textBoxInt.Location = new Point(10,150);
textBoxInt.Size = new Size(150,15);
textBoxInt.Text = "15000.00";
this.Controls.Add(textBoxInt);
labelRate = new Label();
labelRate.Location = new Point(10,45);
labelRate.Size = new Size(144,15);
labelRate.Text = "Zinsrate";
this.Controls.Add(labelRate);
labelInt = new Label();
labelInt.Location = new Point(10,135);
labelInt.Size = new Size(144,15);
labelInt.Text = "Zinssatz";
this.Controls.Add(labelInt);
}
private void onBtnCalcClicked(object sender,System.EventArgs args)
{
double prin = Convert.ToDouble(textBoxPrinc.Text);
double rate = Convert.ToDouble(textBoxRate.Text);
double amt = prin * rate;
string ans = amt.ToString("f2");
textBoxInt.Text = ans;
}
public static void Main(string[] args)
{
Application.Run(new Calculator());
}
}
any suggestions ?
thanks in advance,
Daniel