Gantt Resize and Drag events fire continuously
Posted: Wed Oct 06, 2004 2:17 pm
I have a Gantt Chart with Gantt Drag and Resize allowed. I have event handlers for GanttResizeEventArgs and GanttDragEventArgs. With these event handlers I update my database to reflect changes by the user. However, this event appears to fire continuously as the bar is clicked. Is there anyway to change the timing of this event such that it only fires once the date actually changes?
Here is some debug from the click and drag bar #2 with a start of 10/8 and end and of 10/12:
Drag #2 Jay
Start: 10/8/2004 10:09:13 PM
End: 10/12/2004 10:09:13 PM
Next: -1
Drag #2 Jay
Start: 10/8/2004 10:09:13 PM
End: 10/12/2004 10:09:13 PM
Next: -1
Drag #2 Jay
Start: 10/8/2004 11:04:36 AM
End: 10/12/2004 11:04:36 AM
Next: -1
Drag #2 Jay
Start: 10/8/2004 11:04:36 AM
End: 10/12/2004 11:04:36 AM
Next: -1
Drag #2 Jay
Start: 10/7/2004 12:00:00 PM
End: 10/11/2004 12:00:00 PM
Next: -1
Drag #2 Jay
Start: 10/7/2004 12:00:00 PM
End: 10/11/2004 12:00:00 PM
Next: -1
Drag #2 Jay
Start: 10/7/2004 2:46:09 AM
End: 10/11/2004 2:46:09 AM
Next: -1
Drag #2 Jay
Start: 10/7/2004 2:46:09 AM
End: 10/11/2004 2:46:09 AM
Next: -1
Drag #2 Jay
Start: 10/6/2004 8:18:27 PM
End: 10/10/2004 8:18:27 PM
Next: -1
Drag #2 Jay
Start: 10/6/2004 8:18:27 PM
End: 10/10/2004 8:18:27 PM
Next: -1
Drag #2 Jay
Start: 10/6/2004 11:04:36 AM
End: 10/10/2004 11:04:36 AM
Next: -1
Drag #2 Jay
Start: 10/6/2004 11:04:36 AM
End: 10/10/2004 11:04:36 AM
Next: -1
Drag #2 Jay
Start: 10/6/2004 9:13:50 AM
End: 10/10/2004 9:13:50 AM
Next: -1
Drag #2 Jay
Start: 10/6/2004 9:13:50 AM
End: 10/10/2004 9:13:50 AM
Next: -1
Drag #2 Jay
Start: 10/6/2004 5:32:18 AM
End: 10/10/2004 5:32:18 AM
Next: -1
Drag #2 Jay
Start: 10/6/2004 5:32:18 AM
End: 10/10/2004 5:32:18 AM
Next: -1
Drag #2 Jay
Start: 10/6/2004 5:32:18 AM
End: 10/10/2004 5:32:18 AM
Next: -1
Drag #2 Jay
Start: 10/6/2004 5:32:18 AM
End: 10/10/2004 5:32:18 AM
Next: -1
Drag #2 Jay
Start: 10/6/2004 5:32:18 AM
End: 10/10/2004 5:32:18 AM
Next: -1
Drag #2 Jay
Start: 10/6/2004 5:32:18 AM
End: 10/10/2004 5:32:18 AM
Next: -1
Drag #2 Jay
Start: 10/6/2004 5:32:18 AM
End: 10/10/2004 5:32:18 AM
Next: -1
Drag #2 Jay
Start: 10/6/2004 5:32:18 AM
End: 10/10/2004 5:32:18 AM
Next: -1
Drag #2 Jay
Start: 10/6/2004 5:32:18 AM
End: 10/10/2004 5:32:18 AM
Next: -1
Drag #2 Jay
Start: 10/6/2004 5:32:18 AM
End: 10/10/2004 5:32:18 AM
Next: -1
Drag #2 Jay
Start: 10/6/2004 5:32:18 AM
End: 10/10/2004 5:32:18 AM
Next: -1
Drag #2 Jay
Start: 10/6/2004 5:32:18 AM
End: 10/10/2004 5:32:18 AM
Next: -1
Drag #2 Jay
Start: 10/6/2004 5:32:18 AM
End: 10/10/2004 5:32:18 AM
Next: -1
Drag #2 Jay
Start: 10/6/2004 5:32:18 AM
End: 10/10/2004 5:32:18 AM
Next: -1
Drag #2 Jay
Start: 10/6/2004 5:32:18 AM
End: 10/10/2004 5:32:18 AM
Next: -1
Drag #2 Jay
Start: 10/6/2004 5:32:18 AM
End: 10/10/2004 5:32:18 AM
Next: -1
Drag #2 Jay
Start: 10/6/2004 5:32:18 AM
End: 10/10/2004 5:32:18 AM
Next: -1
Drag #2 Jay
Start: 10/6/2004 5:32:18 AM
End: 10/10/2004 5:32:18 AM
Next: -1
Drag #2 Jay
Start: 10/6/2004 5:32:18 AM
End: 10/10/2004 5:32:18 AM
Next: -1
Drag #2 Jay
Start: 10/6/2004 5:32:18 AM
End: 10/10/2004 5:32:18 AM
Next: -1
Drag #2 Jay
Start: 10/6/2004 5:32:18 AM
End: 10/10/2004 5:32:18 AM
Next: -1
Drag #2 Jay
Start: 10/6/2004 5:32:18 AM
End: 10/10/2004 5:32:18 AM
Next: -1
Drag #2 Jay
Start: 10/6/2004 5:32:18 AM
End: 10/10/2004 5:32:18 AM
Next: -1
Drag #2 Jay
Start: 10/6/2004 5:32:18 AM
End: 10/10/2004 5:32:18 AM
Next: -1
I would like to see something like this:
Drag #2 Jay
Start: 10/6/2004 5:32:18 AM
End: 10/10/2004 5:32:18 AM
Next: -1
Both drag and resize events fire in the same way.
Here are my event handlers:
#region Drag & Resize
/// <summary>
/// Event handler when a bar is dragged
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void ganttTool1_DragBar(object sender, Steema.TeeChart.Tools.GanttDragEventArgs e)
{
DateTime start = DateTime.FromOADate(gantt1.StartValues[e.Bar]);
DateTime end = DateTime.FromOADate(gantt1.EndValues[e.Bar]);
if (this.chkShowDebug.Checked)
{
this.txbOutput.AppendText("\r\n" +
"Drag #" + e.Bar.ToString() + " " + gantt1.Labels[e.Bar] + "\r\n" +
"Start: " + start.ToString() + "\r\n" +
"End: " + end.ToString() + "\r\n" +
"Next: " + gantt1.NextTasks[e.Bar].ToString() + "\r\n");
}
else
{
// Debug.WriteLine("Drag #" + e.Bar.ToString() + " " + gantt1.Labels[e.Bar]);
// Debug.WriteLine("Start: " + start.ToString());
// Debug.WriteLine("End: " + end.ToString());
// Debug.WriteLine("Next: " + gantt1.NextTasks[e.Bar].ToString());
}
UpdateDatabase(e.Bar,gantt1.Labels[e.Bar],start,end);
DataTable table = GetData();
fillDataGrid(table);
}
/// <summary>
/// Event handler when a bar is resized
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void ganttTool1_ResizeBar(object sender, Steema.TeeChart.Tools.GanttResizeEventArgs e)
{
DateTime start = DateTime.FromOADate(gantt1.StartValues[e.Bar]);
DateTime end = DateTime.FromOADate(gantt1.EndValues[e.Bar]);
if (this.chkShowDebug.Checked)
{
this.txbOutput.AppendText("\r\n" +
"Resize #" + e.Bar.ToString() + " " + gantt1.Labels[e.Bar] + "\r\n" +
"Start: " + start.ToString() + "\r\n" +
"End: " + end.ToString() + "\r\n" +
"Next: " + gantt1.NextTasks[e.Bar].ToString() + "\r\n");
}
else
{
// Debug.WriteLine("Resize #" + e.Bar.ToString() + " " + gantt1.Labels[e.Bar]);
// Debug.WriteLine("Start: " + start.ToString());
// Debug.WriteLine("End: " + end.ToString());
// Debug.WriteLine("Next: " + gantt1.NextTasks[e.Bar].ToString());
}
UpdateDatabase(e.Bar,gantt1.Labels[e.Bar],start,end);
DataTable table = GetData();
fillDataGrid(table);
}
#endregion
Thanks
Brian
Here is some debug from the click and drag bar #2 with a start of 10/8 and end and of 10/12:
Drag #2 Jay
Start: 10/8/2004 10:09:13 PM
End: 10/12/2004 10:09:13 PM
Next: -1
Drag #2 Jay
Start: 10/8/2004 10:09:13 PM
End: 10/12/2004 10:09:13 PM
Next: -1
Drag #2 Jay
Start: 10/8/2004 11:04:36 AM
End: 10/12/2004 11:04:36 AM
Next: -1
Drag #2 Jay
Start: 10/8/2004 11:04:36 AM
End: 10/12/2004 11:04:36 AM
Next: -1
Drag #2 Jay
Start: 10/7/2004 12:00:00 PM
End: 10/11/2004 12:00:00 PM
Next: -1
Drag #2 Jay
Start: 10/7/2004 12:00:00 PM
End: 10/11/2004 12:00:00 PM
Next: -1
Drag #2 Jay
Start: 10/7/2004 2:46:09 AM
End: 10/11/2004 2:46:09 AM
Next: -1
Drag #2 Jay
Start: 10/7/2004 2:46:09 AM
End: 10/11/2004 2:46:09 AM
Next: -1
Drag #2 Jay
Start: 10/6/2004 8:18:27 PM
End: 10/10/2004 8:18:27 PM
Next: -1
Drag #2 Jay
Start: 10/6/2004 8:18:27 PM
End: 10/10/2004 8:18:27 PM
Next: -1
Drag #2 Jay
Start: 10/6/2004 11:04:36 AM
End: 10/10/2004 11:04:36 AM
Next: -1
Drag #2 Jay
Start: 10/6/2004 11:04:36 AM
End: 10/10/2004 11:04:36 AM
Next: -1
Drag #2 Jay
Start: 10/6/2004 9:13:50 AM
End: 10/10/2004 9:13:50 AM
Next: -1
Drag #2 Jay
Start: 10/6/2004 9:13:50 AM
End: 10/10/2004 9:13:50 AM
Next: -1
Drag #2 Jay
Start: 10/6/2004 5:32:18 AM
End: 10/10/2004 5:32:18 AM
Next: -1
Drag #2 Jay
Start: 10/6/2004 5:32:18 AM
End: 10/10/2004 5:32:18 AM
Next: -1
Drag #2 Jay
Start: 10/6/2004 5:32:18 AM
End: 10/10/2004 5:32:18 AM
Next: -1
Drag #2 Jay
Start: 10/6/2004 5:32:18 AM
End: 10/10/2004 5:32:18 AM
Next: -1
Drag #2 Jay
Start: 10/6/2004 5:32:18 AM
End: 10/10/2004 5:32:18 AM
Next: -1
Drag #2 Jay
Start: 10/6/2004 5:32:18 AM
End: 10/10/2004 5:32:18 AM
Next: -1
Drag #2 Jay
Start: 10/6/2004 5:32:18 AM
End: 10/10/2004 5:32:18 AM
Next: -1
Drag #2 Jay
Start: 10/6/2004 5:32:18 AM
End: 10/10/2004 5:32:18 AM
Next: -1
Drag #2 Jay
Start: 10/6/2004 5:32:18 AM
End: 10/10/2004 5:32:18 AM
Next: -1
Drag #2 Jay
Start: 10/6/2004 5:32:18 AM
End: 10/10/2004 5:32:18 AM
Next: -1
Drag #2 Jay
Start: 10/6/2004 5:32:18 AM
End: 10/10/2004 5:32:18 AM
Next: -1
Drag #2 Jay
Start: 10/6/2004 5:32:18 AM
End: 10/10/2004 5:32:18 AM
Next: -1
Drag #2 Jay
Start: 10/6/2004 5:32:18 AM
End: 10/10/2004 5:32:18 AM
Next: -1
Drag #2 Jay
Start: 10/6/2004 5:32:18 AM
End: 10/10/2004 5:32:18 AM
Next: -1
Drag #2 Jay
Start: 10/6/2004 5:32:18 AM
End: 10/10/2004 5:32:18 AM
Next: -1
Drag #2 Jay
Start: 10/6/2004 5:32:18 AM
End: 10/10/2004 5:32:18 AM
Next: -1
Drag #2 Jay
Start: 10/6/2004 5:32:18 AM
End: 10/10/2004 5:32:18 AM
Next: -1
Drag #2 Jay
Start: 10/6/2004 5:32:18 AM
End: 10/10/2004 5:32:18 AM
Next: -1
Drag #2 Jay
Start: 10/6/2004 5:32:18 AM
End: 10/10/2004 5:32:18 AM
Next: -1
Drag #2 Jay
Start: 10/6/2004 5:32:18 AM
End: 10/10/2004 5:32:18 AM
Next: -1
Drag #2 Jay
Start: 10/6/2004 5:32:18 AM
End: 10/10/2004 5:32:18 AM
Next: -1
Drag #2 Jay
Start: 10/6/2004 5:32:18 AM
End: 10/10/2004 5:32:18 AM
Next: -1
Drag #2 Jay
Start: 10/6/2004 5:32:18 AM
End: 10/10/2004 5:32:18 AM
Next: -1
Drag #2 Jay
Start: 10/6/2004 5:32:18 AM
End: 10/10/2004 5:32:18 AM
Next: -1
I would like to see something like this:
Drag #2 Jay
Start: 10/6/2004 5:32:18 AM
End: 10/10/2004 5:32:18 AM
Next: -1
Both drag and resize events fire in the same way.
Here are my event handlers:
#region Drag & Resize
/// <summary>
/// Event handler when a bar is dragged
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void ganttTool1_DragBar(object sender, Steema.TeeChart.Tools.GanttDragEventArgs e)
{
DateTime start = DateTime.FromOADate(gantt1.StartValues[e.Bar]);
DateTime end = DateTime.FromOADate(gantt1.EndValues[e.Bar]);
if (this.chkShowDebug.Checked)
{
this.txbOutput.AppendText("\r\n" +
"Drag #" + e.Bar.ToString() + " " + gantt1.Labels[e.Bar] + "\r\n" +
"Start: " + start.ToString() + "\r\n" +
"End: " + end.ToString() + "\r\n" +
"Next: " + gantt1.NextTasks[e.Bar].ToString() + "\r\n");
}
else
{
// Debug.WriteLine("Drag #" + e.Bar.ToString() + " " + gantt1.Labels[e.Bar]);
// Debug.WriteLine("Start: " + start.ToString());
// Debug.WriteLine("End: " + end.ToString());
// Debug.WriteLine("Next: " + gantt1.NextTasks[e.Bar].ToString());
}
UpdateDatabase(e.Bar,gantt1.Labels[e.Bar],start,end);
DataTable table = GetData();
fillDataGrid(table);
}
/// <summary>
/// Event handler when a bar is resized
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void ganttTool1_ResizeBar(object sender, Steema.TeeChart.Tools.GanttResizeEventArgs e)
{
DateTime start = DateTime.FromOADate(gantt1.StartValues[e.Bar]);
DateTime end = DateTime.FromOADate(gantt1.EndValues[e.Bar]);
if (this.chkShowDebug.Checked)
{
this.txbOutput.AppendText("\r\n" +
"Resize #" + e.Bar.ToString() + " " + gantt1.Labels[e.Bar] + "\r\n" +
"Start: " + start.ToString() + "\r\n" +
"End: " + end.ToString() + "\r\n" +
"Next: " + gantt1.NextTasks[e.Bar].ToString() + "\r\n");
}
else
{
// Debug.WriteLine("Resize #" + e.Bar.ToString() + " " + gantt1.Labels[e.Bar]);
// Debug.WriteLine("Start: " + start.ToString());
// Debug.WriteLine("End: " + end.ToString());
// Debug.WriteLine("Next: " + gantt1.NextTasks[e.Bar].ToString());
}
UpdateDatabase(e.Bar,gantt1.Labels[e.Bar],start,end);
DataTable table = GetData();
fillDataGrid(table);
}
#endregion
Thanks
Brian