[Mono-dev] Keypress events ignored

Paul paul at all-the-johnsons.co.uk
Sun Mar 25 08:38:35 EDT 2007


Hi,

I have the following code (snipped so you can see the problem)

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

namespace ctrix {
  /// <summary>
  /// Summary description for .
  /// </summary>
  public class ctrix : System.Windows.Forms.Form {
     internal System.Windows.Forms.PictureBox PicBackground;

// code

     this.Controls.Add(this.CmdStart);
     this.Controls.Add(this.PicNextBlock);
     this.Controls.Add(this.LblNextBlock);
     this.Controls.Add(this.lblScoreValue);
     this.Controls.Add(this.lblScore);
     this.Controls.Add(this.PicBackground);
     this.FormBorderStyle =
System.Windows.Forms.FormBorderStyle.FixedToolWindow;
     this.Name = "ctrix";
     this.Text = "ctrix";
     this.KeyDown += new
System.Windows.Forms.KeyEventHandler(this.ctrix_KeyDown);
     this.Load += new System.EventHandler(this.ctrix_Load);
     this.Activated += new System.EventHandler(this.ctrix_Activated);
     this.ResumeLayout(false);
   }
   private void ctrix_KeyDown(object sender,
System.Windows.Forms.KeyEventArgs e) 
   {
     switch(e.KeyCode) 
     {
        case Keys.X:  CurrentBlock.Right();break;
        case Keys.Z:  CurrentBlock.Left();break;
        case Keys.K:  CurrentBlock.Rotate();break;
        case Keys.Escape:
			tmrGameClock.Enabled = !tmrGameClock.Enabled;
			if (tmrGameClock.Enabled)
			  this.Text = "ctrix";
			else
			  this.Text = "ctrix -- Press 'Esc' to Continue";
			break;
	default: break;
     }
     Invalidate();
   }

When I compile this using gmcs, the compile works, but no key events are
seen (under Linux). If I send it to a Win32 box, the key events occur.

Are keyevents currently not functioning properly or am I missing
something?

TTFN

Paul
-- 
Sie können mich aufreizen und wirklich heiß machen!
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20070325/25f66dae/attachment.bin 


More information about the Mono-devel-list mailing list