11039 : How to get the snapped time values in the Gantt1_OnTimeItem_StopValueResize event?

Question
 
I have a gantt chart/grid where I have set the start and stopsnap times. After I change the stop time of timeitem, the cooresponding column in the grid changes to the ‘snapped’ time.  How can I get this value to use instead of the true time from the Gantt1_OnTimeItem_StopValueResize event?

Trying: e.TimeItem.GanttRow.GridNode.GetCell(3).Content.Value
gives me the original stoptime of the timeitem and : Gantt1.FocusedTimeItem.Stop.Add(e.Diff).ToString
gives me the new stoptime w/out being snapped as indicated.

Thank you for your help.

Answer
 
The snapping is calculated after the OnTimeItem_StopValueResize event, but you can use the same logic we do to calculate the snapped value: Gantt.DateScaler.SnapTime(time,precision).
 
So try this:
TimeBeforeSnap=e.TimeItem.Stop.Add(e.Diff);
TimeAfterSnap=Gantt1.DateScaler.SnapTime(TimeBeforeSnap,e.TimeItem.TimeItemLayout.SnapStopTime);
 
 

10605 : AfterMove when no move

Question

At runtime, when I click on a timeitem, sometimes the event gSchedule_OnTimeItem_AfterMove will raise. It causes a bug to happen.

How to prevent this?

Answer

A click on a time item can be percieved as a very quick and very small move of the time item.
The best way to tell the Gantt that these “none moves” should be ignored is to assing some value to the Snapping parameters of the TimeItemLayout for that TimeItem. Snapping will round the values so that the moving is controlled by a snapping grid.

See SnapStartTime and SnapStopTime in the help file.