diff --git a/PROMS/Volian.Controls.Library/DisplaySearch.cs b/PROMS/Volian.Controls.Library/DisplaySearch.cs index 447b6de9..38de36b7 100644 --- a/PROMS/Volian.Controls.Library/DisplaySearch.cs +++ b/PROMS/Volian.Controls.Library/DisplaySearch.cs @@ -2058,7 +2058,10 @@ namespace Volian.Controls.Library } } buildStepTypePannelTitle(); - + // B2021-100: Enable/disable the RNO Only checkbox & WORD Sections tree node in Step Elements to Search. + // The only time the RNO Only checkbox is disabled is if the only selection in Step Elements to Search is WORD Sections. + cbxRnoOnly.Enabled = true; + if (OnlyWordSectTypeSel()) cbxRnoOnly.Checked = cbxRnoOnly.Enabled = false; } private void xpStepTypes_ExpandedChanged(object sender, ExpandedChangeEventArgs e) @@ -2167,11 +2170,30 @@ namespace Volian.Controls.Library Clipboard.SetDataObject(myDO); } } + private bool OnlyWordSectTypeSel() + { + // B2021-100: Enable/disable the RNO Only checkbox & WORD Sections tree node in Step Elements to Search. + // lstCheckedStepTypes[x] = 0 for Word sections: + if (lstCheckedStepTypes != null && lstCheckedStepTypes.Count == 1 && lstCheckedStepTypes[0] == 0) return true; + return false; + } private void CbxRnoOnly_Click(object sender, System.EventArgs e) { // C2021-028: RNO Only search, disable Word section tree node: - wordSectionTreeNode.Enabled = !(tabSearchTypes.SelectedTab == tabTranSearch || !cbxRnoOnly.Checked); - if (!wordSectionTreeNode.Enabled) wordSectionTreeNode.Checked = false; + // B2021 - 100: Enable / disable the RNO Only checkbox &WORD Sections tree node in Step Elements to Search. + if (tabSearchTypes.SelectedTab == tabTranSearch) return; + + wordSectionTreeNode.Enabled = true; + if (!cbxRnoOnly.Checked) // checked turning on + { + // Set enabling on WORD Sections tree node in Step Elements to Search. If either no items are selected in tree or + // just WORD Section is selected, then disable the WORD Section tree node. Otherwise, i.e. other step types are selected + // in tree, thus they must be searched using RNO Only so need to disable anything. + wordSectionTreeNode.Enabled = !(OnlyWordSectTypeSel() || (lstCheckedStepTypes != null && lstCheckedStepTypes.Count == 0)); + if (!wordSectionTreeNode.Enabled) wordSectionTreeNode.Checked = false; + } + else // turning off - WORD Sections tree node is enabled. + wordSectionTreeNode.Enabled = true; } private void cmFndTxtPaste_Click(object sender, EventArgs e) {