diff --git a/PROMS/Volian.Controls.Library/DisplayRO.cs b/PROMS/Volian.Controls.Library/DisplayRO.cs index c94309a4..591b4b07 100644 --- a/PROMS/Volian.Controls.Library/DisplayRO.cs +++ b/PROMS/Volian.Controls.Library/DisplayRO.cs @@ -69,11 +69,14 @@ namespace Volian.Controls.Library get { return _MyRTB; } set { + int origRoDbId = -1; if (!Visible) return; if (_MyRTB != null) { _MyRTB.LinkChanged -= new StepRTBLinkEvent(MyRTB_LinkChanged); _MyRTB.SelectionChanged -= new EventHandler(MyRTB_SelectionChanged); + if (_MyRTB.MyItemInfo.MyDocVersion.DocVersionAssociationCount>0) + origRoDbId = _MyRTB.MyItemInfo.MyDocVersion.DocVersionAssociations[0].MyROFst.RODbID; } if (value == null) return; _MyRTB = value; @@ -84,6 +87,17 @@ namespace Volian.Controls.Library CurROLink = null; _SavCurROLink = null; } + // Test to see if this myrtf is using the same rofst as the previous. If + // not we may have to reset the ro.fst for the tree if the new working + // draft has a different ro.fst than the original: + if (_MyRTB != null && _MyRTB.MyItemInfo.MyDocVersion.DocVersionAssociationCount > 0) + { + if (origRoDbId != _MyRTB.MyItemInfo.MyDocVersion.DocVersionAssociations[0].MyROFst.RODbID) + MyROFST = _MyRTB.MyItemInfo.MyDocVersion.DocVersionAssociations[0].MyROFst; + } + // This docversion doesn't have an rofst associated with it, clear the ro tree. + else if (_MyRTB.MyItemInfo.MyDocVersion.DocVersionAssociationCount <= 0) + MyROFST = null; } } @@ -95,7 +109,8 @@ namespace Volian.Controls.Library if (MyRTB.SelectedText != "") { string lookFor = MyRTB.SelectedText; - List children = _MyROFST.ROFSTLookup.GetRosByValue(lookFor); + List children = null; + if (_MyROFST != null) children = _MyROFST.ROFSTLookup.GetRosByValue(lookFor); if (children != null) { lbFound.Visible = true; @@ -372,7 +387,12 @@ namespace Volian.Controls.Library } private void LoadTree() { - if (_MyROFST == null) return; + if (_MyROFST == null) + { + tvROFST.Nodes.Clear(); + _CurROFST = null; + return; + } if (_MyROFST == _CurROFST && ROTypeFilter == _CurrentROTypeFilter) return; tvROFST.Nodes.Clear(); _CurROFST = _MyROFST;