From 700d9656b2dc8e2672d3794ca8c3371b721b0fea Mon Sep 17 00:00:00 2001 From: mschill Date: Wed, 14 May 2025 11:42:51 -0400 Subject: [PATCH] B2025-028 RO Editor - Parent Child Applicability - Default Values While working with parent/child applicability with child applicability set for a setpoint group - assign the Setpoint Values and Short Description fields to have Child values. All child values default to their parent values as expected. However, if you click in the Parent field for the Short Description, the Child Values for the Short Description fields incorrectly defaulted to the Parent Setpoint Value instead of keeping the parent Short Description. --- .../LibSource/ctlXMLEditLib/ctlXMLEdit.cs | 21 +++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/PROMS/ReferencedObjects/LibSource/ctlXMLEditLib/ctlXMLEdit.cs b/PROMS/ReferencedObjects/LibSource/ctlXMLEditLib/ctlXMLEdit.cs index 57a279a3..0313cf28 100644 --- a/PROMS/ReferencedObjects/LibSource/ctlXMLEditLib/ctlXMLEdit.cs +++ b/PROMS/ReferencedObjects/LibSource/ctlXMLEditLib/ctlXMLEdit.cs @@ -1192,14 +1192,27 @@ namespace ctlXMLEditLib // C2021-026 Event handler for Parent/Child child textbox // if the textbox text is same as parent, then or nothing is entered in the textbox // then use the parent value and set the text color to gray + // B2025-028 RO Editor - Parent Child Applicability - Default Values + // Were always setting to the Group parent value instead of individual parent values + // When leaving the textbox private void txtBox_Leave(object sender, EventArgs e) { TextBox tb = sender as TextBox; string dfTxt = ""; - string parName = pcGrpBox.Name.Substring(5); - object o = myHT[parName]; - if (o != null) - dfTxt = (o as TextBox).Text; // set to use the parent's value (default) + try + { + ctlXMLEdit tmp = (ctlXMLEdit)tb?.Parent; + if (!string.IsNullOrEmpty(tmp?.ActiveControl.Text)) + dfTxt = tmp.ActiveControl.Text; + } + catch + { + string parName = pcGrpBox.Name.Substring(5); + object o = myHT[parName]; + if (o != null) + dfTxt = (o as TextBox).Text; // set to use the parent's value (default) + } + if (dosaveflag) mysavexml = true; if (tb.Text.Length == 0 || tb.Text == dfTxt) { -- 2.47.2