Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Item Click event (Read 3583 times)
SimonL
YaBB Newbies
*
Offline



Posts: 36
Joined: Aug 11th, 2006
Item Click event
Oct 10th, 2006 at 11:00am
Print Post  
Hi,

I've added code to the item click event to check if the user has double clicked an item. If so I display one of my own forms for the user to fill out.

Unfortunately when the form is closed the item moves in the calendar control with the movement of the mouse.

I tried temporarily setting the item.locked property to true in the click event, displaying my form then resetting the locked property, but the item still moves about.

How can I prevent this.

Regards,
Simon
  
Back to top
 
IP Logged
 
Meppy
God Member
*****
Offline


MindFusion support

Posts: 1783
Joined: Jul 20th, 2005
Re: Item Click event
Reply #1 - Oct 10th, 2006 at 11:09am
Print Post  
Invoke the Calendar.ResetDrag method before displaying your custom form. Wink

Meppy
  
Back to top
 
IP Logged
 
SimonL
YaBB Newbies
*
Offline



Posts: 36
Joined: Aug 11th, 2006
Re: Item Click event
Reply #2 - Oct 10th, 2006 at 1:06pm
Print Post  
Thanks Meppy, worked a treat.

Another couple of issues I'm having trouble with.

I'm using trial version pre 4.1 release 6

1. I've set the EnableDragCreate to true. You recently fixed it so that if I click on the calendar control without dragging, then an item is not created in the calendar. However if I add a context menu to an item, right click then click off the menu back onto the calendar control it creates a tiny item.

2. When dragging to create can I force the item being created to be at least one unit wide (in my case a day) or multiples there of.

3. Still seem to have a problem with preventing collisions. Particularly when dragging from other lanes. After dragging two or three times it eventually allows the overlap.

Regards,
Simon

  
Back to top
 
IP Logged
 
Meppy
God Member
*****
Offline


MindFusion support

Posts: 1783
Joined: Jul 20th, 2005
Re: Item Click event
Reply #3 - Oct 11th, 2006 at 6:19am
Print Post  
1. I've set the EnableDragCreate to true. You recently fixed it so that if I click on the calendar control without dragging, then an item is not created in the calendar. However if I add a context menu to an item, right click then click off the menu back onto the calendar control it creates a tiny item.

The following vesion should fix this issue:

https://mindfusion.org/_planner/_Planner.NET_41pre_trial9.zip

2. When dragging to create can I force the item being created to be at least one unit wide (in my case a day) or multiples there of.

You can handle ItemCreating and ItemModifying events and add the following code to them:

Code
Select All
//... ItemModifying event handler ...
if (e.NewEndTime - e.NewStartTime < TimeSpan.FromHours(1))
  e.NewEndTime = e.NewStartTime + TimeSpan.FromHours(1);

// ... ItemCreating event handler ...
if (e.Item.EndTime - e.Item.StartTime < TimeSpan.FromHours(1))
  e.Item.EndTime = e.Item.StartTime + TimeSpan.FromHours(1); 


This sample code prevents items from being shorter than 1 hour.

3. Still seem to have a problem with preventing collisions. Particularly when dragging from other lanes. After dragging two or three times it eventually allows the overlap.

I was trying to reproduce this here, but was unsuccessful so far. If you can send me the code of your ItemModifying event handler and describe the scenario which enables this to happen in more details, I will look into it further.

Meppy
  
Back to top
 
IP Logged
 
SimonL
YaBB Newbies
*
Offline



Posts: 36
Joined: Aug 11th, 2006
Re: Item Click event
Reply #4 - Oct 11th, 2006 at 9:40am
Print Post  
Excellent. All working perfectly now even item 3

(3. Still seem to have a problem with preventing collisions. Particularly when dragging from other lanes. After dragging two or three times it eventually allows the overlap.)
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint