[MonoDevelop] S.W.F -> Gtk# Mappings

Jonathan Darrer jondarrer@hotmail.com
Thu, 15 Jan 2004 10:26:25 +0000


This is a multi-part message in MIME format.

------=_NextPart_000_1882_34e5_1402
Content-Type: text/plain; format=flowed

I've put together a simple Form. If someone would like to port it to Gtk# to 
demonstrate the process, it would be much appreciated. :)

Jonathan


>From: John Luke <jluke@users.sourceforge.net>
>Date: Mon, 12 Jan 2004 18:20:44 -0500
>On Mon, 2004-01-12 at 23:04 +0000, Jonathan Darrer wrote:
>>Hi,
>>
>>I'm from a S.W.F background - albeit minimal. I'd appreciate an example - 
>>just to get a little familiar with the basics, as the documentation on the 
>>Mono website has not yet been written. I think it might be useful on the 
>>website too, for a few reasons. To give people an idea of how the port was 
>>done, and show them how to go about doing something similar themselves. I 
>>don't want to waste anyone's time, and it's by no means urgent, but I 
>>would appreciate it. :o)
>>
>>Jonathan
>>
>>NB. Something with a Form, MainMenu, Panel, TextBox, Buttons and some 
>>Events would be good.
>If you right the SWF example and post it here one of us (or one of the
>other people on the list) can post the Gtk# version.

_________________________________________________________________
Express yourself with cool new emoticons http://www.msn.co.uk/specials/myemo

------=_NextPart_000_1882_34e5_1402
Content-Type: text/plain; name="Form1.cs"; format=flowed
Content-Transfer-Encoding: 8bit
Content-Disposition: attachment; filename="Form1.cs"

using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;

namespace WindowsApplication1
{
	/// <summary>
	/// Summary description for Form1.
	/// </summary>
	public class Form1 : System.Windows.Forms.Form
	{
		private System.Windows.Forms.Panel panel1;
		private System.Windows.Forms.Panel panel2;
		private System.Windows.Forms.Panel panel3;
		private System.Windows.Forms.Label label1;
		private System.Windows.Forms.TextBox textBox1;
		private System.Windows.Forms.Button button1;
		private System.Windows.Forms.MainMenu mainMenu1;
		private System.Windows.Forms.MenuItem menuItem1;
		private System.Windows.Forms.MenuItem menuItem2;
		private System.Windows.Forms.ToolTip toolTip1;
		private System.Windows.Forms.Label label2;
		private System.ComponentModel.IContainer components;

		public Form1()
		{
			//
			// Required for Windows Form Designer support
			//
			InitializeComponent();

			//
			// TODO: Add any constructor code after InitializeComponent call
			//
		}

		/// <summary>
		/// Clean up any resources being used.
		/// </summary>
		protected override void Dispose( bool disposing )
		{
			if( disposing )
			{
				if (components != null)
				{
					components.Dispose();
				}
			}
			base.Dispose( disposing );
		}

		#region Windows Form Designer generated code
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{
			this.components = new System.ComponentModel.Container();
			this.panel1 = new System.Windows.Forms.Panel();
			this.panel3 = new System.Windows.Forms.Panel();
			this.label1 = new System.Windows.Forms.Label();
			this.panel2 = new System.Windows.Forms.Panel();
			this.button1 = new System.Windows.Forms.Button();
			this.textBox1 = new System.Windows.Forms.TextBox();
			this.mainMenu1 = new System.Windows.Forms.MainMenu();
			this.menuItem1 = new System.Windows.Forms.MenuItem();
			this.menuItem2 = new System.Windows.Forms.MenuItem();
			this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);
			this.label2 = new System.Windows.Forms.Label();
			this.panel1.SuspendLayout();
			this.panel3.SuspendLayout();
			this.panel2.SuspendLayout();
			this.SuspendLayout();
			//
			// panel1
			//
			this.panel1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
			this.panel1.Controls.AddRange(new System.Windows.Forms.Control[] {
																				 this.label2,
																				 this.panel3,
																				 this.panel2});
			this.panel1.Location = new System.Drawing.Point(16, 16);
			this.panel1.Name = "panel1";
			this.panel1.Size = new System.Drawing.Size(344, 240);
			this.panel1.TabIndex = 0;
			//
			// panel3
			//
			this.panel3.Controls.AddRange(new System.Windows.Forms.Control[] {
																				 this.label1});
			this.panel3.Location = new System.Drawing.Point(16, 88);
			this.panel3.Name = "panel3";
			this.panel3.Size = new System.Drawing.Size(312, 120);
			this.panel3.TabIndex = 1;
			//
			// label1
			//
			this.label1.Font = new System.Drawing.Font("Arial", 36F, 
System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 
((System.Byte)(0)));
			this.label1.ForeColor = System.Drawing.SystemColors.Desktop;
			this.label1.Location = new System.Drawing.Point(8, 8);
			this.label1.Name = "label1";
			this.label1.Size = new System.Drawing.Size(296, 104);
			this.label1.TabIndex = 0;
			this.label1.Text = "label1";
			//
			// panel2
			//
			this.panel2.Controls.AddRange(new System.Windows.Forms.Control[] {
																				 this.button1,
																				 this.textBox1});
			this.panel2.Location = new System.Drawing.Point(16, 48);
			this.panel2.Name = "panel2";
			this.panel2.Size = new System.Drawing.Size(312, 40);
			this.panel2.TabIndex = 0;
			//
			// button1
			//
			this.button1.Location = new System.Drawing.Point(224, 8);
			this.button1.Name = "button1";
			this.button1.TabIndex = 2;
			this.button1.Text = "Press Me!";
			this.button1.Click += new System.EventHandler(this.button1_Click);
			//
			// textBox1
			//
			this.textBox1.Location = new System.Drawing.Point(8, 8);
			this.textBox1.Name = "textBox1";
			this.textBox1.Size = new System.Drawing.Size(136, 20);
			this.textBox1.TabIndex = 0;
			this.textBox1.Text = "textBox1";
			this.toolTip1.SetToolTip(this.textBox1, "Type in the text you would like 
to display.");
			//
			// mainMenu1
			//
			this.mainMenu1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
																					  this.menuItem1});
			//
			// menuItem1
			//
			this.menuItem1.Index = 0;
			this.menuItem1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
																					  this.menuItem2});
			this.menuItem1.Text = "&File";
			//
			// menuItem2
			//
			this.menuItem2.Index = 0;
			this.menuItem2.Text = "E&xit";
			this.menuItem2.Click += new System.EventHandler(this.menuItem2_Click);
			//
			// toolTip1
			//
			this.toolTip1.AutoPopDelay = 5000;
			this.toolTip1.InitialDelay = 1000;
			this.toolTip1.ReshowDelay = 500;
			this.toolTip1.ShowAlways = true;
			//
			// label2
			//
			this.label2.Font = new System.Drawing.Font("Arial", 11.25F, 
System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 
((System.Byte)(0)));
			this.label2.Location = new System.Drawing.Point(16, 16);
			this.label2.Name = "label2";
			this.label2.Size = new System.Drawing.Size(312, 24);
			this.label2.TabIndex = 2;
			this.label2.Text = "Type into the textbox and press the button.";
			//
			// Form1
			//
			this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
			this.ClientSize = new System.Drawing.Size(376, 273);
			this.Controls.AddRange(new System.Windows.Forms.Control[] {
																		  this.panel1});
			this.Menu = this.mainMenu1;
			this.Name = "Form1";
			this.Text = "Sample WinForm App";
			this.Load += new System.EventHandler(this.Form1_Load);
			this.panel1.ResumeLayout(false);
			this.panel3.ResumeLayout(false);
			this.panel2.ResumeLayout(false);
			this.ResumeLayout(false);

		}
		#endregion

		/// <summary>
		/// The main entry point for the application.
		/// </summary>
		[STAThread]
		static void Main()
		{
			Application.Run(new Form1());
		}

		/// <summary>
		/// Changes the label1 text to that of textBox1.
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void button1_Click(object sender, System.EventArgs e)
		{
			this.label1.Text = this.textBox1.Text;
		}

		/// <summary>
		/// Exits the application.
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void menuItem2_Click(object sender, System.EventArgs e)
		{
			Application.Exit();
		}

		/// <summary>
		/// Handles the loading of the form.
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void Form1_Load(object sender, System.EventArgs e)
		{

			//
			// Set the label1 text to that of textBox1.
			//
			this.label1.Text = this.textBox1.Text;
		}
	}
}


------=_NextPart_000_1882_34e5_1402--