11019 : OnTimeItem_AfterMove event, the TimeItemEventArgs returns 0 in its X and Y fields?

Question

 

I am trying cause an interaction between two objects (represented by timeitems in the Gantt) that is triggered when one timeitem is moved on top of another. When trying to implement this by using the OnTimeItem_AfterMove event, the TimeItemEventArgs returns 0 in its X and Y fields. This is not good, since I am trying to find the “lower” timeitem by using the Gantt.TimeItemFromPoint method.< ?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

1) Why does the TimeItemEventArgs return these values?

2) If this is not fixable, how do I find the relevant timeitem?

 

Answer

 

1) The mouse position is not relevant after the mouse button is released, and the draw rectangle of the time item is not updated until the next render-sweep, what is valid here is the Start and Stop of the time item (collisiondetection may affect Y pixel pos, datescaler changes my change X pixel pos)

 

2) In the AfterMove the Start and Stop is updated. You can use those along with the DateScaler.TimeToPixel to get the X position and from that look for the time item that is on that position with TimeItemFromPoint.

 

Leave a Reply