Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Drag and Drop - between 2 calendar controls (Read 3381 times)
Lemings
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 6
Joined: Mar 23rd, 2011
Drag and Drop - between 2 calendar controls
Mar 23rd, 2011 at 2:47pm
Print Post  
Hi everybody,
I am quite new with Scheduling and have one problem. I have 2 calendars - one with appointments where the time is already specified, second is a list of appointments where the time has to be specified. We would like to move the appointments from the 2nd list to 1st one - i have tried to start drag and drop on MouseDown event and it works quite well. But there is one problem - the dragged item stays selected after a click (even when i don't drag and release the button) and when there are more days in the source calendar, the appointment keeps moving with the mouse (inside the source calendar). is there any way how to inteligently design a drag and drop?
Second question is whether it is possible to move an appointment from one contact to another? i have 2 contact displayed and want to move an appointment from contact a to contact b - i can only move the appointment within one contact now. Edit: of course i mean moving with mouse inside the displayed calendar, not in program, where i can simply change a contact for the appointment
  
Back to top
 
IP Logged
 
Meppy
God Member
*****
Offline


MindFusion support

Posts: 1783
Joined: Jul 20th, 2005
Re: Drag and Drop - between 2 calendar controls
Reply #1 - Mar 23rd, 2011 at 3:22pm
Print Post  
1. Stick with your current drag & drop strategy. To prevent the calendar from capturing the mouse click though, call the Calendar.ResetDrag method just before initiating your own drag & drop operation.

2. To interactively move items across resources, hold down the modifier key specified by the ItemChangeReferenceKey property (ALT by default) before initiating the modification. To remove the requirement to hold down a key, set this property to None.

Let me know if this helps.

Regards,
Meppy
  
Back to top
 
IP Logged
 
Lemings
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 6
Joined: Mar 23rd, 2011
Re: Drag and Drop - between 2 calendar controls
Reply #2 - Mar 24th, 2011 at 9:26am
Print Post  
Hi Meppy, thanks for a quick answer, the Alt+move works perfectly!
But still the first problem remains there - i click the app and it keeps moving through days in the timetable view. I have the code like this now:
       private void calNezarazene_MouseDown(object sender, MouseEventArgs e)
       {
           Item item = calNezarazene.GetItemAt(e.Location);
           if (item != null)
           {
               vybranapolozka = item;
               calNezarazene.ResetDrag();
               DoDragDrop(new CalendarDragData(vybranapolozka.HeaderText, vybranapolozka.Tag.ToString()), DragDropEffects.Copy);
           }
       }
  
Back to top
 
IP Logged
 
Meppy
God Member
*****
Offline


MindFusion support

Posts: 1783
Joined: Jul 20th, 2005
Re: Drag and Drop - between 2 calendar controls
Reply #3 - Mar 24th, 2011 at 10:06am
Print Post  
The problem is that the Calendar.MouseDown event is raised just before the interaction on the item has started and ResetDrag has no effect at this point. The best way to resolve this is to initiate Drag & Drop on mouse move (when the appropriate mouse button is pressed) instead of on click. The other option is to invoke Calendar.ResetDrag in the Calendar.ItemModifying event handler.

Let me know if this helps.

Regards,
Meppy
  
Back to top
 
IP Logged
 
Lemings
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 6
Joined: Mar 23rd, 2011
Re: Drag and Drop - between 2 calendar controls
Reply #4 - Mar 24th, 2011 at 1:44pm
Print Post  
Hello Meppy,
i did it on mouse move + left button clicked and it works perfectly! Thanks for your help. It helped me to solve quite a big problem with the customer and I hope that soon he will buy the program and therefore I will be able to buy your GREAT solution Smiley
Lemings
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint