From e45c373920ef7362097fc00d7d9f33bac468e6ee Mon Sep 17 00:00:00 2001 From: Kathy Ruffing Date: Mon, 20 Nov 2023 10:21:52 -0500 Subject: [PATCH] B2023-112: Search All Procedure Sets does not always work --- .../Volian.Controls.Library/DisplaySearch.cs | 30 ++++++++++++++----- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/PROMS/Volian.Controls.Library/DisplaySearch.cs b/PROMS/Volian.Controls.Library/DisplaySearch.cs index 10ab6520..4eb4ead5 100644 --- a/PROMS/Volian.Controls.Library/DisplaySearch.cs +++ b/PROMS/Volian.Controls.Library/DisplaySearch.cs @@ -796,6 +796,10 @@ namespace Volian.Controls.Library node.Checked = pNode.Checked; CheckTreeNodeChildren(node.Nodes); } + // B2023-112: Clear the docversion list - this flags 'All' when the 'All Proc Sets' tree node is checked and 'None' when it isn't. Then + // Use buildSetToSearchPanelTitle to set the text for how many sets are in search. + lstCheckedDocVersions.Clear(); + buildSetToSearchPanelTitle(); } private void AllSectionTypes_clicked(object sender, EventArgs e) @@ -2392,18 +2396,18 @@ namespace Volian.Controls.Library { if (tn.Checked) { - tn.Style = DevComponents.AdvTree.NodeStyles.Apple; // sets green background on selected folder(s) - FolderInfo fi = (FolderInfo)tn.Tag; - + //tn.Style = DevComponents.AdvTree.NodeStyles.Apple; // sets green background on selected folder(s) + //B2023-112: Don't crash if on top 'All' node (did not have associated folder) + FolderInfo fi = tn.Tag as FolderInfo; // if this folder has a docversion, use its id: if (tn.Nodes != null && tn.Nodes.Count > 0 && tn.Nodes[0].Text != DummyNodeText) // Folder has been expanded, so add its docversion list { - if (fi.FolderDocVersionCount > 0) lstCheckedDocVersions.Add(fi.FolderDocVersions[0]); + if (fi != null && fi.FolderDocVersionCount > 0) lstCheckedDocVersions.Add(fi.FolderDocVersions[0]); } else // it has not been expanded process all below. { //B2023-076: Do not process the "Select All" node - if (tn.Text != SelectAllProcedureSetsText) + if (tn.Text != SelectAllProcedureSetsText && fi != null) AddAllChildVersions(fi); } } @@ -2548,7 +2552,16 @@ namespace Volian.Controls.Library private void buildSetToSearchPanelTitle() { - if (lstCheckedDocVersions.Count == 0) + // B2023-112: lstCheckedDocVersions has list of sets, if 'all' it is empty. However, in order to get proc set tree to handle appropriate selections + // and work with this list, check both the list count and the whether the 'all' is checked. + if (lstCheckedDocVersions.Count == 0 && advTreeProcSets.Nodes != null && (advTreeProcSets.Nodes.Count <=1 || (advTreeProcSets.Nodes.Count > 1 && advTreeProcSets.Nodes[0].Nodes != null)) && (advTreeProcSets.Nodes[0].Nodes.Count == 0 || (advTreeProcSets.Nodes[0].Nodes.Count > 0 && !advTreeProcSets.Nodes[0].Nodes[0].Checked))) + { + xpSetToSearch.TitleText = string.Format("No Procedure Sets Selected"); + xpSetToSearch.TitleStyle.BackColor1.Color = Color.PapayaWhip; + btnSearch.Enabled = false; + tabSearchTypes.Enabled = false; // disable all the search tabs + } + else if (lstCheckedDocVersions.Count == 0) { xpSetToSearch.TitleText = string.Format("All Procedure Sets Selected"); xpSetToSearch.TitleStyle.BackColor1.Color = Color.PapayaWhip; @@ -2577,6 +2590,9 @@ namespace Volian.Controls.Library StartAdvTreeStepTypesFillIn();// B2016-258 Hang after selecting a procedure if the Step Type panel is open on the search panel } } + // B2023-112: If unchecking a procedure set, uncheck the 'All' node also + if (n.Checked) + advTreeProcSets.Nodes[0].Nodes[0].Checked = false; } #endregion @@ -2595,7 +2611,7 @@ namespace Volian.Controls.Library if (n.Checked) { - n.Style = DevComponents.AdvTree.NodeStyles.Apple; + //n.Style = DevComponents.AdvTree.NodeStyles.Apple; // B2023-112: coloring of proc set tree nodes was not working correctly if (sd == null) { -- 2.47.2