Skip to content
This repository was archived by the owner on Sep 25, 2024. It is now read-only.
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 90e8e6d

Browse files
committedDec 16, 2019
[Mac] Use the NSView.Tag property to set which control is the 1st one to receive focus.
1 parent f315c52 commit 90e8e6d

18 files changed

+30
-5
lines changed
 

‎Xamarin.PropertyEditing.Mac/Controls/BasePointEditorControl.cs

+1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ protected BasePointEditorControl (IHostResourceProvider hostResources)
2828

2929
XEditor = new NumericSpinEditor<T> (hostResources) {
3030
BackgroundColor = NSColor.Clear,
31+
Tag = 1,
3132
Value = 0.0f
3233
};
3334
XEditor.ValueChanged += OnInputUpdated;

‎Xamarin.PropertyEditing.Mac/Controls/BaseRectangleEditorControl.cs

+1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ protected BaseRectangleEditorControl (IHostResourceProvider hostResources)
3333
};
3434
XEditor = new NumericSpinEditor<T> (hostResources) {
3535
BackgroundColor = NSColor.Clear,
36+
Tag = 1,
3637
Value = 0.0f
3738
};
3839
XEditor.ValueChanged += OnInputUpdated;

‎Xamarin.PropertyEditing.Mac/Controls/BooleanEditorControl.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ internal class BooleanEditorControl
1111
public BooleanEditorControl (IHostResourceProvider hostResource)
1212
: base (hostResource)
1313
{
14-
BooleanEditor = new FocusableBooleanButton ();
14+
BooleanEditor = new FocusableBooleanButton () { Tag = 1 };
1515

1616
// update the value on 'enter'
1717
BooleanEditor.Activated += (sender, e) => {

‎Xamarin.PropertyEditing.Mac/Controls/BrushEditorControl.cs

+1
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ public BrushEditorControl (IHostResourceProvider hostResources)
5656
this.popUpButton = new ColorPopUpButton {
5757
ControlSize = NSControlSize.Small,
5858
Font = NSFont.SystemFontOfSize (NSFont.SystemFontSizeForControlSize (NSControlSize.Small)),
59+
Tag = 1,
5960
TranslatesAutoresizingMaskIntoConstraints = false,
6061
};
6162

‎Xamarin.PropertyEditing.Mac/Controls/CharEditorControl.cs

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ internal class CharEditorControl
99
public CharEditorControl (IHostResourceProvider hostResources)
1010
: base (hostResources)
1111
{
12+
Entry.Tag = 1;
1213
}
1314

1415
protected override EntryPropertyEditorDelegate<char> CreateDelegate (PropertyViewModel<char> viewModel)

‎Xamarin.PropertyEditing.Mac/Controls/CollectionInlineEditorControl.cs

+2-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ public CollectionInlineEditorControl (IHostResourceProvider hostResources)
2121
Title = Properties.Resources.CollectionEditButton,
2222
BezelStyle = NSBezelStyle.Rounded,
2323
AccessibilityEnabled = true,
24-
AccessibilityHelp = Properties.Resources.AccessibilityCollectionHelp
24+
AccessibilityHelp = Properties.Resources.AccessibilityCollectionHelp,
25+
Tag = 1,
2526
};
2627

2728
this.openCollection.Activated += (o, e) => {

‎Xamarin.PropertyEditing.Mac/Controls/CombinablePropertyEditor.cs

+1
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ protected override void OnViewModelChanged (PropertyViewModel oldModel)
8282
}
8383

8484
checkbox.Title = choice.Name;
85+
checkbox.Tag = i == 0 ? 1 : -1;
8586

8687
this.combinableList[checkbox] = choice;
8788
top += subrowHeight;

‎Xamarin.PropertyEditing.Mac/Controls/Custom/NumericSpinEditor.cs

+6
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,12 @@ public override string AccessibilityTitle {
171171
set { this.numericEditor.AccessibilityTitle = value; }
172172
}
173173

174+
public new nint Tag
175+
{
176+
get { return this.numericEditor.Tag; }
177+
set { this.numericEditor.Tag = value; }
178+
}
179+
174180
public virtual void Reset ()
175181
{
176182
}

‎Xamarin.PropertyEditing.Mac/Controls/Custom/PropertyButton.cs

+2-1
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,8 @@ private void FocusClickedRow ()
172172
private void MakeFocusableKeyViewFirstResponder (NSView[] subViews)
173173
{
174174
foreach (NSView item in subViews) {
175-
if (item.CanBecomeKeyView) {
175+
if (item.CanBecomeKeyView
176+
&& item.Tag == 1) {
176177
Window?.MakeFirstResponder (item);
177178
break;
178179
} else {

‎Xamarin.PropertyEditing.Mac/Controls/DateTimeEditorControl.cs

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ public DateTimeEditorControl (IHostResourceProvider hostResources)
1616
DatePickerElements = NSDatePickerElementFlags.HourMinuteSecond | NSDatePickerElementFlags.YearMonthDateDay,
1717
DatePickerStyle = NSDatePickerStyle.TextFieldAndStepper,
1818
Font = NSFont.SystemFontOfSize (NSFont.SystemFontSizeForControlSize (NSControlSize.Small)),
19+
Tag = 1,
1920
TranslatesAutoresizingMaskIntoConstraints = false
2021
};
2122

‎Xamarin.PropertyEditing.Mac/Controls/FilePathEditorControl.cs

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ public FilePathEditorControl (IHostResourceProvider hostResource)
1414
: base (hostResource)
1515
{
1616
this.currentTextField.ToolTip = this.currentTextField.PlaceholderString = string.Format (Properties.Resources.ChooseFileOrDirectory, Properties.Resources.File);
17+
this.currentTextField.Tag = 1;
1718
this.panel.CanChooseFiles = true;
1819
this.panel.CanChooseDirectories = false;
1920
this.revealPathButton.ToolTip = string.Format (Properties.Resources.RevealFileOrDirectory, Properties.Resources.File);

‎Xamarin.PropertyEditing.Mac/Controls/NumericEditorControl.cs

+3-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@ public NumericEditorControl (IHostResourceProvider hostResources)
1616
{
1717
base.TranslatesAutoresizingMaskIntoConstraints = false;
1818

19-
NumericEditor = new NumericSpinEditor<T> (hostResources);
19+
NumericEditor = new NumericSpinEditor<T> (hostResources) {
20+
Tag = 1
21+
};
2022
NumericEditor.ValueChanged += OnValueChanged;
2123

2224
var t = typeof (T);

‎Xamarin.PropertyEditing.Mac/Controls/ObjectEditorControl.cs

+1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ public ObjectEditorControl (IHostResourceProvider hostResources)
2222
this.createObject = new FocusableButton {
2323
Title = Properties.Resources.New,
2424
BezelStyle = NSBezelStyle.Rounded,
25+
Tag = 1,
2526
};
2627
this.createObject.Activated += OnNewPressed;
2728
AddSubview (this.createObject);

‎Xamarin.PropertyEditing.Mac/Controls/PredefinedValuesEditor.cs

+2
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ private void RequirePopup()
108108
},
109109
ControlSize = NSControlSize.Small,
110110
Font = NSFont.SystemFontOfSize (NSFont.SystemFontSizeForControlSize (NSControlSize.Small)),
111+
Tag = 1,
111112
TranslatesAutoresizingMaskIntoConstraints = false,
112113
StringValue = String.Empty,
113114
};
@@ -154,6 +155,7 @@ private void RequireComboBox()
154155
},
155156
ControlSize = NSControlSize.Small,
156157
Font = NSFont.SystemFontOfSize (NSFont.SystemFontSizeForControlSize (NSControlSize.Small)),
158+
Tag = 1,
157159
TranslatesAutoresizingMaskIntoConstraints = false,
158160
StringValue = String.Empty,
159161
};

‎Xamarin.PropertyEditing.Mac/Controls/RatioEditorControl.cs

+3-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@ public RatioEditorControl (IHostResourceProvider hostResources)
1515
{
1616
base.TranslatesAutoresizingMaskIntoConstraints = false;
1717

18-
this.ratioEditor = new RatioEditor<T> (hostResources);
18+
this.ratioEditor = new RatioEditor<T> (hostResources) {
19+
Tag = 1,
20+
};
1921
this.ratioEditor.SetFormatter (null);
2022

2123
// update the value on keypress

‎Xamarin.PropertyEditing.Mac/Controls/StringEditorControl.cs

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ public StringEditorControl (IHostResourceProvider hostResources)
1515
: base (hostResources)
1616
{
1717
this.lastKeyView = Entry;
18+
Entry.Tag = 1;
1819
}
1920

2021
public override NSView LastKeyView => this.lastKeyView;

‎Xamarin.PropertyEditing.Mac/Controls/TimeSpanEditorControl.cs

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ internal class TimeSpanEditorControl
99
public TimeSpanEditorControl (IHostResourceProvider hostResources)
1010
: base (hostResources)
1111
{
12+
Entry.Tag = 1;
1213
}
1314

1415
protected override EntryPropertyEditorDelegate<TimeSpan> CreateDelegate (PropertyViewModel<TimeSpan> viewModel)

‎Xamarin.PropertyEditing.Mac/Controls/TypeEditorControl.cs

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ public TypeEditorControl (IHostResourceProvider hostResources)
2121

2222
this.selectType = new FocusableButton {
2323
BezelStyle = NSBezelStyle.Rounded,
24+
Tag = 1,
2425
Title = Properties.Resources.Select,
2526
};
2627
this.selectType.Activated += OnSelectPressed;

0 commit comments

Comments
 (0)
This repository has been archived.