- Welcome, Guest. Please Login or Register
MindFusion  
  MindFusion Xamarin Pack beta version includes diagram, chart and calendar controls for Xamarin.Forms. Now beta testing Chart and Gauge components for Java Swing.  
  HomeHelpSearchLoginRegister   
     
     
   
 
Page Index Toggle Pages: 1 Send Topic Print  
Create a new appointment at single left click
Read 48 times

AncaZ   Offline
YaBB Newbies
*
Posts: 20
I Love MindFusion!


   
     
 
Create a new appointment at single left click
Mar 14th, 2017 at 11:10am
 
Hello,

How can I create an appointment when I press left click on a cell? Not drag and drop.
I see the method that caches the left click event is:
Code (Java):
 @Override
            public void dateClick(ResourceDateEvent e) { 


The problem is that here I don't have the item.
Do you have an example with the implementation of an Item object?

Thank you.
 
 
 
IP Logged    
 
     

Meppy   Offline
YaBB Moderator
*****
Posts: 1727
Gender: male
MindFusion support


   
     
 
Re: Create a new appointment at single left click
Reply #1 - Mar 14th, 2017 at 2:35pm
 
Hi,

Your approach is correct. Simply create a new item in the dateClick method by using the specified date (and resource, if applicable) and add it to the schedule:

Code:
@Override
public void dateClick(ResourceDateEvent e) {
	calendar.resetDrag();
	Appointment app = new Appointment();
	app.setStartTime(e.getDate());
	app.setEndTime(e.getDate().addHours(2));
	if (e.getResource() != null)
		app.getResources().add(e.getResource());
	calendar.getSchedule().getItems().add(app);
} 


Note the call to resetDrag. This is done to terminate the interaction that will start in response to the left click (e.g. select).

Regards,
Meppy
 
 
« Last Edit: Mar 14th, 2017 at 3:55pm by Meppy »
 
IP Logged    
 
     

AncaZ   Offline
YaBB Newbies
*
Posts: 20
I Love MindFusion!


   
     
 
Re: Create a new appointment at single left click
Reply #2 - Mar 14th, 2017 at 3:17pm
 
Works perfectly Smiley
Thank a lot.
 
 
 
IP Logged    
 
     
Page Index Toggle Pages: 1 Send Topic Print