Skip to content

Commit 7f3cba2

Browse files
committed
Parse EnterPressControl for text boxes in INItializableWindows
1 parent 10b9f7a commit 7f3cba2

1 file changed

Lines changed: 11 additions & 3 deletions

File tree

src/TSMapEditor/UI/Controls/INItializableWindow.cs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ private void ReadLateAttributesForControl(XNAControl control)
248248
{
249249
// This logic should also be enabled for other types in the future,
250250
// but it requires changes in XNAUI
251-
if (child is XNATextBox)
251+
if (child is XNATextBox textBox)
252252
{
253253
string nextControl = childSection.GetStringValue("NextControl", null);
254254

@@ -257,7 +257,7 @@ private void ReadLateAttributesForControl(XNAControl control)
257257
var otherChild = children.Find(c => c.Name == nextControl);
258258
if (otherChild != null)
259259
{
260-
((XNATextBox)child).NextControl = otherChild;
260+
textBox.NextControl = otherChild;
261261

262262
if (otherChild is XNATextBox otherAsTb)
263263
{
@@ -272,7 +272,15 @@ private void ReadLateAttributesForControl(XNAControl control)
272272
{
273273
var otherChild = children.Find(c => c.Name == previousControl);
274274
if (otherChild != null)
275-
((XNATextBox)child).PreviousControl = otherChild;
275+
textBox.PreviousControl = otherChild;
276+
}
277+
278+
string enterPressControl = childSection.GetStringValue("EnterPressControl", null);
279+
if (!string.IsNullOrWhiteSpace(enterPressControl))
280+
{
281+
var otherChild = children.Find(c => c.Name == enterPressControl);
282+
if (otherChild != null)
283+
textBox.EnterPressed += (s, e) => otherChild.OnLeftClick(new InputEventArgs());
276284
}
277285
}
278286

0 commit comments

Comments
 (0)