diff --git a/PROMS/Volian.Controls.Library/DisplayTransition.cs b/PROMS/Volian.Controls.Library/DisplayTransition.cs index 831578bc..3fc76114 100644 --- a/PROMS/Volian.Controls.Library/DisplayTransition.cs +++ b/PROMS/Volian.Controls.Library/DisplayTransition.cs @@ -748,6 +748,10 @@ namespace Volian.Controls.Library _InitializingTrans = true; // just initializing now, don't set any ranges, etc. tvTranFillIn(secitm.Steps[0]); tvTran.Enabled = true; + // if doing a 'new' range, no node is selected in tree. Without this, the first node in the + // tree was the selected node which was throwing off the logic for defining the _RangeNode1 + // and _RangeNode2 + if (_DoingRange) tvTran.SelectedNode = null; _InitializingTrans = false; } } @@ -875,35 +879,21 @@ namespace Volian.Controls.Library return; } toItem = (ItemInfo)_RangeNode1.VEObject; - if (_RangeNode2 == null && tvTran.SelectedNode == null) - // If this is Transition type 2, then make 'rangenode2' same as rangenode1 - // This will get resolved when transition text is resolved. This case represents - // range from rangenode1 to last sibling. Otherwise, get the second item in the - // range, based on current tree view selection. - if (listBoxTranFmt.SelectedIndex == 2) { - rangeItem = toItem; - } - else - { - if (_RangeNode2 == null && tvTran.SelectedNode == null) - { - MessageBox.Show("Must 'Select Step' for range transition 'to'"); - return; - } - if (_RangeNode2 == null) _RangeNode2 = (VETreeNode)tvTran.SelectedNode; - rangeItem = (ItemInfo)_RangeNode2.VEObject; + MessageBox.Show("Must 'Select Step' for range transition 'to'"); + return; } if (_RangeNode2 == null) _RangeNode2 = (VETreeNode)tvTran.SelectedNode; rangeItem = (ItemInfo)_RangeNode2.VEObject; // If this is Transition type 2, then make 'rangenode2' same as rangenode1 // This will get resolved when transition text is resolved. This case represents - // range from rangenode1 to last sibling. Otherwise, get the second item in the + // range from rangenode1 to last sibling. Note that this is only done if within + // the same sibling group. Otherwise, get the second item in the // range, based on current tree view selection. if (listBoxTranFmt.SelectedIndex == 2) { - // if type 2 and not a HLS and the range is within the same hls, them set + // if type 2 and not a HLS and the range is within the same hls, then set // to and range to be equal. When text gets resolved, this case generates // a list represent the toid,,,lastsibling. if (!toItem.IsHigh && toItem.MyHLS.ItemID == rangeItem.MyHLS.ItemID) @@ -917,6 +907,20 @@ namespace Volian.Controls.Library MessageBox.Show("Must select two items at the step level or below, i.e. no sections, procedures, etc."); return; } + // be sure that the order is right, i.e. to is before range in list. + if (toItem.ItemID != rangeItem.ItemID) + { + Boolean switchIds = false; + // check for order of hls first, then do within sibling list. + if (toItem.MyHLS.Ordinal > rangeItem.MyHLS.Ordinal) switchIds = true; + else if (toItem.Ordinal > rangeItem.Ordinal) switchIds = true; + if (switchIds) + { + ItemInfo switchItem = toItem; + toItem = rangeItem; + rangeItem = switchItem; + } + } linktxt = string.Format("#Link:TransitionRange:{0} {1} {2}", listBoxTranFmt.SelectedIndex, toItem.ItemID, rangeItem.ItemID); } else if ((etm & E_TransUI.StepFirst) == E_TransUI.StepFirst)