Author: jackson
Date: 2005-06-23 14:03:21 -0400 (Thu, 23 Jun 2005)
New Revision: 46447

Modified:
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TabControl.cs
Log:

        * TabControl.cs: Keyboard handling. We now support CTRL-TAB,
        CTRL-SHIFT-TAB, and HOME, END are there any others?



Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog        
2005-06-23 18:00:40 UTC (rev 46446)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog        
2005-06-23 18:03:21 UTC (rev 46447)
@@ -1,5 +1,10 @@
 2005-06-23  Jackson Harper  <[EMAIL PROTECTED]>
 
+       * TabControl.cs: Keyboard handling. We now support CTRL-TAB,
+       CTRL-SHIFT-TAB, and HOME, END are there any others?
+
+2005-06-23  Jackson Harper  <[EMAIL PROTECTED]>
+
        * XplatUIX11.cs: Get the modifier keys from the keyboard driver.
 
 2005-06-22  Jordi Mas i Hernandez <[EMAIL PROTECTED]>

Modified: 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TabControl.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TabControl.cs    
2005-06-23 18:00:40 UTC (rev 46446)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TabControl.cs    
2005-06-23 18:03:21 UTC (rev 46447)
@@ -410,6 +410,40 @@
                        base.OnStyleChanged (e);
                }
 
+               protected override bool ProcessKeyPreview (ref Message m)
+               {
+                       if (ProcessKeyEventArgs (ref m))
+                               return true;
+                       return base.ProcessKeyPreview (ref m);
+               }
+
+               protected override void OnKeyDown (KeyEventArgs e)
+               {
+                       if (e.KeyCode == Keys.Tab && (e.KeyData & Keys.Control) 
!= 0) {
+                               if ((e.KeyData & Keys.Shift) == 0)
+                                       SelectedIndex = (SelectedIndex + 1) % 
TabCount;
+                               else
+                                       SelectedIndex = (SelectedIndex - 1) % 
TabCount;
+                               e.Handled = true;
+                       } else if (e.KeyCode == Keys.Home) {
+                               SelectedIndex = 0;
+                       } else if (e.KeyCode == Keys.End) {
+                               SelectedIndex = TabCount - 1;
+                       }
+
+                       base.OnKeyDown (e);
+               }
+
+               protected override bool IsInputKey (Keys key)
+               {
+                       switch (key & Keys.KeyCode) {
+                       case Keys.Prior:
+                       case Keys.Home:
+                               return true;
+                       }
+                       return base.IsInputKey (key);
+               }
+
                protected override void Dispose (bool disposing)
                {
                        base.Dispose (disposing);

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to