dotgnu-general
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[DotGNU]Imcomplete System.Drawing.Xsharp.DrawingWindow.MapKey(KeyName)?


From: Mohan Embar
Subject: [DotGNU]Imcomplete System.Drawing.Xsharp.DrawingWindow.MapKey(KeyName)?
Date: Tue, 29 Jul 2003 05:04:21 -0500

Hi Rhys,

The following program illustrates inconsistent behavior
under Xsharp and MS .NET (WinXP).

If you run this program and press S or [Ctrl+S], you'll
see three events (KeyDown, KeyPress, KeyUp) generated
under MS .NET as opposed to one event (KeyPress) under
Xsharp.

To remedy this, more entries would be needed in
System.Drawing.Xsharp.DrawingWindow.MapKey(KeyName), but
I didn't submit a patch because I was too lazy to make
these entries. Note also that there are no corresponding
entries in System.Drawing.Toolkit.ToolkitKeys for
things like accented characters, etc., so maybe another
approach is needed other than checking whether MapKey(KeyName)
returns something other than ToolkitKeys.None when
determining whether to generate KeyDown and KeyUp
events.

Let me know if you'd like me to follow up on this.

-- Mohan
http://www.thisiscool.com/
http://www.animalsong.org/

------------------------8<-------------------------
using System;
using System.Drawing;
using System.Diagnostics;
using System.Windows.Forms;

public class MainForm : Form
{
  
  private MainForm()
  {
    SetStyle(ControlStyles.ResizeRedraw, true);
    KeyDown += new KeyEventHandler(HandleKeyDown);
    KeyPress += new KeyPressEventHandler(HandleKeyPress);
    KeyUp += new KeyEventHandler(HandleKeyUp);
  }

  private void HandleKeyDown(Object sender, KeyEventArgs e)
  {
    Console.WriteLine("KeyDown: "+e);
  }
  
  private void HandleKeyPress(Object sender, KeyPressEventArgs e)
  {
    Console.WriteLine("KeyPress: "+e);
  }
  
  private void HandleKeyUp(Object sender, KeyEventArgs e)
  {
    Console.WriteLine("KeyUp: "+e);
  }
  
  public static void Main(String[] args)
  {
    Form form = new MainForm();
    form.Width = 400;
    form.Height = 350;
    form.Text = "KeyTest";
    Application.Run(form);
  }
}
------------------------8<-------------------------







reply via email to

[Prev in Thread] Current Thread [Next in Thread]