Fixed code for treeview select after selected step deleted
This commit is contained in:
parent
d17c81a9d9
commit
37099ec443
@ -264,15 +264,41 @@ namespace VEPROMS
|
||||
/// <summary>
|
||||
/// When the treeview is clicked - a timer is set
|
||||
/// This is done because the focus is returned to the treeview after the click event
|
||||
/// This approach did not work and was replaced with the code below.
|
||||
/// The problem was that each time the treeview was clicked, the last selected node
|
||||
/// was opened again, or the edit window was repositioned.
|
||||
/// If the item was deleted and another treenode expanded, the click to expand the
|
||||
/// node would cause the deleted node to be selected.
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void tv_Click(object sender, EventArgs e)
|
||||
//private void tv_Click(object sender, EventArgs e)
|
||||
//{
|
||||
//tv.Enabled = false;
|
||||
//tmrTreeView.Enabled = true;
|
||||
//}
|
||||
/// <summary>
|
||||
/// This opens nodes if the mouse is within the bounds of a node.
|
||||
/// By using the timer, the focus can be passed to the edit window.
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
void tv_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e)
|
||||
{
|
||||
if (e.Button != MouseButtons.Right)
|
||||
{
|
||||
Point newPoint = new Point(e.X, e.Y);
|
||||
VETreeNode tn = tv.GetNodeAt(newPoint) as VETreeNode;
|
||||
// Check to make sure that a node has been selected and
|
||||
// that the mouse is within the bounds of the node.
|
||||
if (tn != null && tn.Bounds.Left < newPoint.X)
|
||||
{
|
||||
tv.SelectedNode = tn;
|
||||
tv.Enabled = false;
|
||||
tmrTreeView.Enabled = true;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// This event is fired from the timer after the treeview click event completes
|
||||
/// </summary>
|
||||
|
Loading…
x
Reference in New Issue
Block a user