diff options
author | Jose Medrano <josmed@microsoft.com> | 2022-02-16 20:23:47 +0300 |
---|---|---|
committer | vs-mobiletools-engineering-service2 <valco@microsoft.com> | 2022-03-01 18:01:15 +0300 |
commit | c90a281fa9a2e4131c851cc772f10c9c31a6092a (patch) | |
tree | 38eef3daa3189a515db82a864d0ee2e7922dca85 | |
parent | 0a7bce75f503fb8847030b9a62a1acce3ef359e5 (diff) |
Makes NumericTextField a ProxyResponder class
-rw-r--r-- | Xamarin.PropertyEditing.Mac/Controls/Custom/NumericTextField.cs | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/Xamarin.PropertyEditing.Mac/Controls/Custom/NumericTextField.cs b/Xamarin.PropertyEditing.Mac/Controls/Custom/NumericTextField.cs index 4c215b7..7f324cf 100644 --- a/Xamarin.PropertyEditing.Mac/Controls/Custom/NumericTextField.cs +++ b/Xamarin.PropertyEditing.Mac/Controls/Custom/NumericTextField.cs @@ -51,6 +51,22 @@ namespace Xamarin.PropertyEditing.Mac Delegate = keyUpDownDelegate; } + public ProxyRowResponder ResponderProxy + { + get { + if (Delegate is KeyUpDownDelegate keydown) { + return keydown.ResponderProxy; + } + return null; + } + set + { + if (Delegate is KeyUpDownDelegate keydown) { + keydown.ResponderProxy = value; + } + } + } + public override CGSize IntrinsicContentSize => new CGSize(30, 20); public override bool ShouldBeginEditing (NSText textObject) @@ -156,14 +172,16 @@ namespace Xamarin.PropertyEditing.Mac } } - internal class KeyUpDownDelegate : NSTextFieldDelegate + internal class KeyUpDownDelegate : TextNextResponderDelegate { public event EventHandler<bool> KeyArrowUp; public event EventHandler<bool> KeyArrowDown; public override bool DoCommandBySelector (NSControl control, NSTextView textView, Selector commandSelector) { - switch (commandSelector.Name) { + if (!base.DoCommandBySelector(control, textView, commandSelector)) + { + switch (commandSelector.Name) { case "moveUp:": OnKeyArrowUp (); break; @@ -178,6 +196,7 @@ namespace Xamarin.PropertyEditing.Mac break; default: return false; + } } return true; |