Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic ResourceView: restrict movement (Read 7724 times)
Achim
Junior Member
**
Offline


MindFusion rocks!

Posts: 70
Location: Bayreuth, Germany
Joined: Jun 28th, 2012
ResourceView: restrict movement
Jun 26th, 2014 at 8:47am
Print Post  
Hi there,

when I allow a user in ResourceView to move items I want to be able to restrict movements either horizontally (only on timeline) or vertically (only to other resources). For vertical restriction I'm using the following code:

Code (C++)
Select All
private void onItemModifying(object sender, ItemModifyConfirmEventArgs args)
{
       //First of all we need to restrict movement to resources (i.e. in vertical direction only)
       args.NewStartTime = args.Item.StartTime;
       args.NewEndTime = args.Item.EndTime;
}
 



Unfortunately this won't work with resources because the Resource-property of ItemModifyConfirmEventArgs is read-only.

Any solutions on this?

Best regards
Achim
  
Back to top
WWW  
IP Logged
 
Meppy
God Member
*****
Offline


MindFusion support

Posts: 1783
Joined: Jul 20th, 2005
Re: ResourceView: restrict movement
Reply #1 - Jun 26th, 2014 at 9:54am
Print Post  
Hi,

You can prevent items from being moved to other resources by setting Calendar.ItemChangeResourceKey to any non-modifier key, for example Keys.NoName. This property however will only have effect at the start of the interaction. If you set it while the item is already being dragged, it will have no effect until a new item interaction has started.

Let me know if this helps.

Regards,
Meppy
  
Back to top
 
IP Logged
 
Achim
Junior Member
**
Offline


MindFusion rocks!

Posts: 70
Location: Bayreuth, Germany
Joined: Jun 28th, 2012
Re: ResourceView: restrict movement
Reply #2 - Jun 26th, 2014 at 11:05am
Print Post  
Hi Meppy,

the point is: I want to prevent individual items from being moved to another resource. So I have a gantt chart with some items that can be freely moved, some only vertical, some only horizonally and some that are locked in place. It depends on their type and state.

Regards
Achim
  
Back to top
WWW  
IP Logged
 
Meppy
God Member
*****
Offline


MindFusion support

Posts: 1783
Joined: Jul 20th, 2005
Re: ResourceView: restrict movement
Reply #3 - Jun 26th, 2014 at 1:47pm
Print Post  
Indeed this scenario is not currently possible. We will try to extend the control to enable it.

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


MindFusion support

Posts: 1783
Joined: Jul 20th, 2005
Re: ResourceView: restrict movement
Reply #4 - Jun 27th, 2014 at 1:03pm
Print Post  
Check your personal messages for an update.

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


I Love MindFusion!

Posts: 8
Joined: Mar 1st, 2016
Re: ResourceView: restrict movement
Reply #5 - Mar 2nd, 2016 at 5:00am
Print Post  
Hi, there,
I Purchased the product this morning, and I also need this functionality. As last entry in this thread is quite old, will you, please, advise whether the feature was implemented in the current version, or I will need a special fix. Thank you in advance!
  
Back to top
 
IP Logged
 
Meppy
God Member
*****
Offline


MindFusion support

Posts: 1783
Joined: Jul 20th, 2005
Re: ResourceView: restrict movement
Reply #6 - Mar 2nd, 2016 at 6:45am
Print Post  
Hi Nikola,

Back then we introduced a new property in the arguments passed to the ItemModifying event, which lets you choose whether an item can move to a different resource when dragged by the user. The property is called AllowChangeResource. Set it to false to prevent users from changing the resource of the modified item:

Code
Select All
calendar.ItemModifying += (s, e) =>
{
	if (e.Item.HeaderText.Contains("no"))
		e.AllowChangeResource = false;
}; 


Let me know if this helps.

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


I Love MindFusion!

Posts: 8
Joined: Mar 1st, 2016
Re: ResourceView: restrict movement
Reply #7 - Mar 4th, 2016 at 8:02am
Print Post  
Hi, Meppy,
Yep, seems to work!
Good stuff!
Thanks a million!
Nikola
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint