10722 : How can I stop ing a TimeItem when user drags the TimeItem into a Time item area which is designated as a holiday or non-working area.

Question

I am using GTP.NET

How can I stop droping a TimeItem when user drags the TimeItem into a Time item area which is designated as a holiday or non-working area.

I have used “OnTimeItemAreaScalerPaintBackground” event to paint holidays and non-working days in different colour. I do not want users to drag the time items into those areas.

Thank you.

Answer

You probably do not want to stop the drag over since it would irritate the user, but you can send visual feedback when the user is over a forbidden area. You can do this by changing the TimeItemLayout of the moving time item in the OnTimeItem_Hoover event: “Fired while mouse is moved and possibly over a time item. This is a good place to set e.Allow false if you do not want to allow the ongoing operation. You can also limit dragging in this event by e.x=gantt1.MouseDownPoint.X; will stop move in x direction ”

When the user actually drop the time item you can check that it is ok in the OnTimeItem_Move event. If it is not ok just set e.Allow=false and it will jump back.

 

Leave a Reply