Added code to locate the currently selected StepItem in the TreeView
This commit is contained in:
parent
a31cfa31a8
commit
61c9d01516
@ -323,11 +323,19 @@ namespace VEPROMS
|
|||||||
// Check to make sure that a node has been selected and
|
// Check to make sure that a node has been selected and
|
||||||
// that the mouse is within the bounds of the node.
|
// that the mouse is within the bounds of the node.
|
||||||
if (tn != null && tn.Bounds.Left < newPoint.X)
|
if (tn != null && tn.Bounds.Left < newPoint.X)
|
||||||
{
|
{
|
||||||
tv.SelectedNode = tn;
|
tv.SelectedNode = tn;
|
||||||
tv.Enabled = false;
|
tv.Enabled = false;
|
||||||
tmrTreeView.Enabled = true;
|
tmrTreeView.Enabled = true;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (tc.SelectedDisplayTabItem != null && tc.SelectedDisplayTabItem.SelectedItemInfo != null)
|
||||||
|
{
|
||||||
|
tv.AdjustTree(tc.SelectedDisplayTabItem.SelectedItemInfo);
|
||||||
|
tc.SelectedDisplayTabItem.Focus();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -293,7 +293,8 @@ namespace Volian.Controls.Library
|
|||||||
#region MenuSupport
|
#region MenuSupport
|
||||||
private void tv_AfterSelect(object sender, TreeViewEventArgs e)
|
private void tv_AfterSelect(object sender, TreeViewEventArgs e)
|
||||||
{
|
{
|
||||||
OnNodeSelectionChange(sender, new vlnTreeEventArgs(e.Node));
|
if(!_AdjustingTree)
|
||||||
|
OnNodeSelectionChange(sender, new vlnTreeEventArgs(e.Node));
|
||||||
}
|
}
|
||||||
// use to determine which menu items have been selected for those tree nodes
|
// use to determine which menu items have been selected for those tree nodes
|
||||||
// that allow more than one type of operation associated with their selection.
|
// that allow more than one type of operation associated with their selection.
|
||||||
@ -1631,6 +1632,46 @@ namespace Volian.Controls.Library
|
|||||||
return false;// Must not be a child at this level
|
return false;// Must not be a child at this level
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
private bool _AdjustingTree = false;
|
||||||
|
public void AdjustTree(ItemInfo selectedItem)
|
||||||
|
{
|
||||||
|
// start at the top parent and walk down the nodes to find child
|
||||||
|
VETreeNode node = FindNodeAndExpand(selectedItem);
|
||||||
|
_AdjustingTree = true;
|
||||||
|
this.SelectedNode = node;
|
||||||
|
_AdjustingTree = false;
|
||||||
|
}
|
||||||
|
public VETreeNode FindNodeAndExpand(IVEDrillDownReadOnly selectedItem)
|
||||||
|
{
|
||||||
|
if (selectedItem.ActiveParent == null)
|
||||||
|
{
|
||||||
|
return (VETreeNode)this.Nodes[0]; // Return the top node
|
||||||
|
}
|
||||||
|
VETreeNode parent = FindNodeAndExpand(selectedItem.ActiveParent);
|
||||||
|
if (!parent.IsExpanded)
|
||||||
|
parent.Expand();
|
||||||
|
foreach (VETreeNode child in parent.Nodes)
|
||||||
|
if (CompareVEObject(child.VEObject, selectedItem))
|
||||||
|
return child;
|
||||||
|
foreach (VETreeNode child in parent.Nodes)
|
||||||
|
foreach (VETreeNode grandchild in child.Nodes)
|
||||||
|
if (CompareVEObject(grandchild.VEObject, selectedItem))
|
||||||
|
return grandchild;
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
public bool CompareVEObject(IVEDrillDownReadOnly obj1, IVEDrillDownReadOnly obj2)
|
||||||
|
{
|
||||||
|
ItemInfo myItem = obj1 as ItemInfo;
|
||||||
|
if (myItem != null)
|
||||||
|
if (myItem.ItemID == ((ItemInfo)obj2).ItemID) return true;
|
||||||
|
DocVersionInfo myDV = obj1 as DocVersionInfo;
|
||||||
|
if (myDV != null)
|
||||||
|
if (myDV.VersionID == ((DocVersionInfo)obj2).VersionID) return true;
|
||||||
|
FolderInfo myFolder = obj1 as FolderInfo;
|
||||||
|
if (myFolder != null)
|
||||||
|
if (myFolder.FolderID == ((FolderInfo)obj2).FolderID) return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#region DragHelper
|
#region DragHelper
|
||||||
public class DragHelper
|
public class DragHelper
|
||||||
|
Loading…
x
Reference in New Issue
Block a user