diff --git a/Src/LexText/LexTextControls/LexOptionsDlg.Designer.cs b/Src/LexText/LexTextControls/LexOptionsDlg.Designer.cs
index 9ea9cdff01..cbb67de647 100644
--- a/Src/LexText/LexTextControls/LexOptionsDlg.Designer.cs
+++ b/Src/LexText/LexTextControls/LexOptionsDlg.Designer.cs
@@ -52,7 +52,7 @@ private void InitializeComponent()
this.m_chDescription = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.m_tabInterface = new System.Windows.Forms.TabPage();
this.m_autoOpenCheckBox = new System.Windows.Forms.CheckBox();
- this.label4 = new System.Windows.Forms.Label();
+ this.m_labelAdvanced = new System.Windows.Forms.Label();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.m_userInterfaceChooser = new SIL.FieldWorks.Common.Widgets.UserInterfaceChooser();
this.label3 = new System.Windows.Forms.Label();
@@ -170,7 +170,7 @@ private void InitializeComponent()
//
resources.ApplyResources(this.m_tabInterface, "m_tabInterface");
this.m_tabInterface.Controls.Add(this.m_autoOpenCheckBox);
- this.m_tabInterface.Controls.Add(this.label4);
+ this.m_tabInterface.Controls.Add(this.m_labelAdvanced);
this.m_tabInterface.Controls.Add(this.groupBox1);
this.m_tabInterface.Name = "m_tabInterface";
this.m_tabInterface.UseVisualStyleBackColor = true;
@@ -181,10 +181,10 @@ private void InitializeComponent()
this.m_autoOpenCheckBox.Name = "m_autoOpenCheckBox";
this.m_autoOpenCheckBox.UseVisualStyleBackColor = true;
//
- // label4
+ // m_labelAdvanced
//
- resources.ApplyResources(this.label4, "label4");
- this.label4.Name = "label4";
+ resources.ApplyResources(this.m_labelAdvanced, "m_labelAdvanced");
+ this.m_labelAdvanced.Name = "m_labelAdvanced";
//
// groupBox1
//
@@ -303,7 +303,7 @@ private void InitializeComponent()
private System.Windows.Forms.ColumnHeader m_chDescription;
private System.Windows.Forms.TabPage m_tabInterface;
private System.Windows.Forms.CheckBox m_autoOpenCheckBox;
- private System.Windows.Forms.Label label4;
+ private System.Windows.Forms.Label m_labelAdvanced;
private System.Windows.Forms.GroupBox groupBox1;
private Common.Widgets.UserInterfaceChooser m_userInterfaceChooser;
private System.Windows.Forms.Label label3;
diff --git a/Src/LexText/LexTextControls/LexOptionsDlg.cs b/Src/LexText/LexTextControls/LexOptionsDlg.cs
index 6d78f4d968..82f770566f 100644
--- a/Src/LexText/LexTextControls/LexOptionsDlg.cs
+++ b/Src/LexText/LexTextControls/LexOptionsDlg.cs
@@ -494,15 +494,15 @@ private void InitializeUIModeControls()
m_uiModeBetaWarning.Location = new System.Drawing.Point(pad, m_uiModeChooser.Bottom + pad);
m_uiModeGroup.Height = m_uiModeBetaWarning.Bottom + pad;
- var delta = m_uiModeGroup.Bottom + pad - label4.Top;
+ var delta = m_uiModeGroup.Bottom + pad - m_labelAdvanced.Top;
if (delta > 0)
{
- // label4 and m_autoOpenCheckBox sit on the Interface tab page and are top-anchored, so
- // push them down manually to clear the injected UI-mode group. tabControl1 (Top+Bottom-
+ // m_labelAdvanced and m_autoOpenCheckBox sit on the Interface tab page and are top-anchored,
+ // so push them down manually to clear the injected UI-mode group. tabControl1 (Top+Bottom-
// anchored) and the OK/Cancel/Help buttons (Bottom-anchored) live on the form and are
// resized/repositioned automatically when the form grows, so they must NOT be moved by
// hand -- doing both shifts them by 2*delta and drops the buttons off the bottom edge.
- label4.Top += delta;
+ m_labelAdvanced.Top += delta;
m_autoOpenCheckBox.Top += delta;
Height += delta;
}
diff --git a/Src/LexText/LexTextControls/LexOptionsDlg.resx b/Src/LexText/LexTextControls/LexOptionsDlg.resx
index 469758c151..cc0a2a0883 100644
--- a/Src/LexText/LexTextControls/LexOptionsDlg.resx
+++ b/Src/LexText/LexTextControls/LexOptionsDlg.resx
@@ -535,16 +535,16 @@ These anonymous statistics will help with future development.
0
-
- label4
+
+ m_labelAdvanced
-
+
System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
+
m_tabInterface
-
+
1
@@ -617,34 +617,34 @@ always open the last edited project automatically
0
-
+
True
-
+
NoControl
-
+
3, 116
-
+
59, 13
-
+
13
-
+
Advanced:
-
- label4
+
+ m_labelAdvanced
-
+
System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
+
m_tabInterface
-
+
1
diff --git a/Src/LexText/LexTextControls/LexTextControlsTests/Avalonia/LexOptionsDlgTests.cs b/Src/LexText/LexTextControls/LexTextControlsTests/Avalonia/LexOptionsDlgTests.cs
index efbcbad96b..a68f3b5ccb 100644
--- a/Src/LexText/LexTextControls/LexTextControlsTests/Avalonia/LexOptionsDlgTests.cs
+++ b/Src/LexText/LexTextControls/LexTextControlsTests/Avalonia/LexOptionsDlgTests.cs
@@ -67,7 +67,7 @@ public void OkClick_LeavesLegacyWhenUserDoesNotChangeSelection()
///
/// Regression test for a "double-shift" layout bug: InitializeUIModeControls() injects a new
/// GroupBox into an already-laid-out Interface tab and must grow the Form to make room. Controls
- /// below the injection point that are top-anchored (label4, m_autoOpenCheckBox) don't move on
+ /// below the injection point that are top-anchored (m_labelAdvanced, m_autoOpenCheckBox) don't move on
/// their own, so the code moves them by hand. Controls that are bottom-anchored (tabControl1,
/// the OK/Cancel/Help buttons) already move/resize automatically as a side effect of Form.Height
/// growing — a prior version of this code ALSO manually re-added the same delta to those, which
@@ -81,7 +81,7 @@ public void InitializeUIModeControls_ShiftsTopAnchoredControlsOnce_NotDoubleShif
using (var dlg = new TestableLexOptionsDlg())
{
var uiModeGroup = FindControlRecursive(dlg, "m_uiModeGroup");
- var label4 = FindControlRecursive(dlg, "label4");
+ var labelAdvanced = FindControlRecursive(dlg, "m_labelAdvanced");
var autoOpenCheckBox = FindControlRecursive(dlg, "m_autoOpenCheckBox");
var tabControl1 = FindControlRecursive(dlg, "tabControl1");
var btnOK = FindControlRecursive(dlg, "m_btnOK");
@@ -89,29 +89,30 @@ public void InitializeUIModeControls_ShiftsTopAnchoredControlsOnce_NotDoubleShif
var btnHelp = FindControlRecursive(dlg, "m_btnHelp");
Assert.That(uiModeGroup, Is.Not.Null);
- Assert.That(label4, Is.Not.Null);
+ Assert.That(labelAdvanced, Is.Not.Null);
Assert.That(autoOpenCheckBox, Is.Not.Null);
Assert.That(tabControl1, Is.Not.Null);
Assert.That(btnOK, Is.Not.Null);
Assert.That(btnCancel, Is.Not.Null);
Assert.That(btnHelp, Is.Not.Null);
- var originalLabel4Top = ReadLexOptionsDlgResxPoint("label4.Location").Y;
+ var originalLabelAdvancedTop = ReadLexOptionsDlgResxPoint("m_labelAdvanced.Location").Y;
var originalAutoOpenTop = ReadLexOptionsDlgResxPoint("m_autoOpenCheckBox.Location").Y;
var originalTabControlHeight = ReadLexOptionsDlgResxSize("tabControl1.Size").Height;
var originalBtnOkTop = ReadLexOptionsDlgResxPoint("m_btnOK.Location").Y;
var originalBtnCancelTop = ReadLexOptionsDlgResxPoint("m_btnCancel.Location").Y;
var originalBtnHelpTop = ReadLexOptionsDlgResxPoint("m_btnHelp.Location").Y;
- // The delta InitializeUIModeControls() computed to make room for the injected group box,
- // derived from the group box's own (live) bottom edge rather than hardcoded, so this test
- // doesn't need updating if m_uiModeGroup's own size/position ever changes.
- var delta = uiModeGroup.Bottom + 8 - originalLabel4Top;
+ // One shift, measured from a control InitializeUIModeControls moves by hand. Deriving it
+ // from observed layout rather than recomputing the padding formula keeps this test about
+ // the relationship -- every affected control moves exactly once -- not the arithmetic.
+ var delta = labelAdvanced.Top - originalLabelAdvancedTop;
Assert.That(delta, Is.GreaterThan(0),
"precondition: the injected group box must actually require extra room for this test to exercise the shift logic");
+ Assert.That(uiModeGroup.Bottom, Is.LessThanOrEqualTo(labelAdvanced.Top),
+ "the injected group must clear the control it pushed down");
- // Top-anchored controls: moved by hand, must shift by exactly delta.
- Assert.That(label4.Top, Is.EqualTo(originalLabel4Top + delta));
+ // The other hand-moved, top-anchored control must shift by the same single delta.
Assert.That(autoOpenCheckBox.Top, Is.EqualTo(originalAutoOpenTop + delta));
// Bottom-anchored controls: WinForms repositions/resizes these automatically as a side