From ca12e39a6b514a52f8c2d570219cbeb80df6523e Mon Sep 17 00:00:00 2001 From: John Date: Thu, 21 Apr 2016 17:31:33 +0000 Subject: [PATCH] =?UTF-8?q?Fixed=20a=20null=20reference=20error=20that=20h?= =?UTF-8?q?appened=20when=20a=20step=20was=20deleted=20from=20the=20tree.?= =?UTF-8?q?=20B2016-105=20Adding=20a=20new=20step=20from=20the=20section?= =?UTF-8?q?=20node=20in=20a=20tree=20will=20now=20consistently=20add=20the?= =?UTF-8?q?=20new=20step=20at=20the=20beginning=20of=20that=20section=20?= =?UTF-8?q?=E2=80=93=20whether=20the=20procedure=20editor=20is=20open=20or?= =?UTF-8?q?=20not.=20=E2=80=93=20B2016-002?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- PROMS/VEPROMS User Interface/frmVEPROMS.cs | 3 ++- PROMS/Volian.Controls.Library/vlnTreeView.cs | 10 ++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/PROMS/VEPROMS User Interface/frmVEPROMS.cs b/PROMS/VEPROMS User Interface/frmVEPROMS.cs index 3ea930e5..278e1e14 100644 --- a/PROMS/VEPROMS User Interface/frmVEPROMS.cs +++ b/PROMS/VEPROMS User Interface/frmVEPROMS.cs @@ -1016,7 +1016,8 @@ namespace VEPROMS if (displayHistory.MyEditItem != null && displayHistory.MyItemInfo.MyProcedure.ItemID == args.MyItemInfo.ItemID) displayHistory.MyEditItem = null; // bug fix B2016-005 - set MyCopyStep to null. This will take the paste options off of the tree node context menus. jsj 4-19-2016 - if (args.MyItemInfo.ItemID == tc.MyCopyStep.ItemID) + // B2016-105 - added null reference check -jsj + if (tc.MyCopyStep != null && args.MyItemInfo.ItemID == tc.MyCopyStep.ItemID) tc.MyCopyStep = null; bool rtval = tc.DeleteRTBItem(args.MyItemInfo); // Also disable the paste options on the ribbon if it is open. jsj 4-19-2016 diff --git a/PROMS/Volian.Controls.Library/vlnTreeView.cs b/PROMS/Volian.Controls.Library/vlnTreeView.cs index 234b6c51..de9192b1 100644 --- a/PROMS/Volian.Controls.Library/vlnTreeView.cs +++ b/PROMS/Volian.Controls.Library/vlnTreeView.cs @@ -2708,12 +2708,18 @@ namespace Volian.Controls.Library else { // The parent step was not open in the step editor, just create new step and add treenode. - using (Step step = Step.MakeStep(_LastItemInfo, _LastItemInfo.LastChild(E_FromType.Step), null, "New Step", 20002, E_FromType.Step)) + // this line (below) adds the new step to the bottom of the section, the other line (not commented) adds it to the top. Bug fix B2016-002 + //using (Step step = Step.MakeStep(_LastItemInfo, _LastItemInfo.LastChild(E_FromType.Step), null, "New Step", 20002, E_FromType.Step)) + using (Step step = Step.MakeStep(_LastItemInfo, null , null, "New Step", 20002, E_FromType.Step)) { ShowBrokenRules(step.BrokenRulesCollection); SetLastValues(StepInfo.Get(step.ItemID)); tn = new VETreeNode(_LastStepInfo); - SelectedNode.Nodes.Add(tn); // add tree node to end of list. + //SelectedNode.Nodes.Add(tn); // add tree node to end of list. + _LastStepInfo.UpdateTransitionText(); + _LastStepInfo.UpdateROText(); + TreeNode par = SelectedNode; + par.Nodes.Insert(0, tn); } }