OnKeyDown() protected method

Raises the Control.KeyDown event.
protected OnKeyDown ( Eto.Forms.KeyEventArgs e ) : void
e Eto.Forms.KeyEventArgs Key event arguments
return void
Esempio n. 1
0
		public static bool KeyDown(Control control, NSEvent theEvent)
		{
			if (control != null)
			{
				var kpea = theEvent.ToEtoKeyPressEventArgs();
				control.OnKeyDown(kpea);
				if (!kpea.Handled)
				{
					var handler = control.Handler as IMacViewHandler;
					if (handler != null)
						handler.PostKeyDown(kpea);
				}

				return kpea.Handled;
			}
			return false;
		}
Esempio n. 2
0
			/// <summary>
			/// Raises the key down event.
			/// </summary>
			public void OnKeyDown(Control widget, KeyEventArgs e)
			{
				widget.Platform.Invoke(() => widget.OnKeyDown(e));
			}
Esempio n. 3
0
		public static bool KeyDown (Control control, NSEvent theEvent)
		{
			if (control != null) {
				char keyChar = !string.IsNullOrEmpty (theEvent.Characters) ? theEvent.Characters [0] : '\0';
				Key key = KeyMap.MapKey (theEvent.KeyCode);
				KeyPressEventArgs kpea;
				Key modifiers = KeyMap.GetModifiers (theEvent);
				key |= modifiers;
				//Console.WriteLine("\t\tkeymap.Add({2}, Key.{0}({1})); {3}", theEvent.Characters, (int)keyChar, theEvent.KeyCode, theEvent.ModifierFlags);
				//Console.WriteLine("\t\t{0} {1} {2}", key & Key.ModifierMask, key & Key.KeyMask, (NSKey)keyChar);
				if (key != Key.None) {
					if (((modifiers & ~(Key.Shift | Key.Alt)) == 0))
						kpea = new KeyPressEventArgs (key, keyChar);
					else
						kpea = new KeyPressEventArgs (key);
				} else {
					kpea = new KeyPressEventArgs (key, keyChar);
				}
				control.OnKeyDown (kpea);
				return kpea.Handled;
			}
			return false;
		}