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.

 

10939 : Tasks constraints

< ?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />Question

 

Is it possible to manage task’s constraints with the GTP .Net 3.0 Component (ie: task1 begin after task 2, task 1 end when task 2 begin, task 1 start 3 month after task 4 etc… like with MS project) ?

And so, is-it possible to draw links starting from the start date of a task and joining the end date of another (with the demo I was only able to join task with end date from the first one and start date of the sconde one) ?

Answer

Task constraints are normaly part of your business logic and not a primaliry concearn for a GUI control, but we offer several events like OnTimeItem_AfterMove that you will want to implement to enforce your rules.

You can also use the TimeItemLinkActions that are available on each link. The LinkAction can be set to some simple rules on how to behave when a TimeItem changes: TimeItemLinkActions are executed when the time items in the link are changed (Start or Stop is changed). LinkActions can help you enforce some of the business rules that you want to stay in effect when the user changes time items

To control where the link is rooted you set the TimeItemLinkStyle property of the link to one of the values :

StartToStart Start of one time item to another time items start. 
StartToStop Start of one time item to another time items stop. 
StopToStart Stop of one time item to another time items start. 
StopToStop Stop of one time item to another time items start.