UltraCalendar simple example

Posted by rogerholmes on 17-Feb-2011 04:29

I'm trying to get a simple Calendar form working, using the UltraWeekView control. So far I have:

Added UltraCalendarInfo and UltraWeekView controls to my form, and then set the CalendarInfo property of UltraWeekView1 to UltraCalendarInfo1. So far so good.

Now I wish to change some of the labels of the Appointment dialog. In the BeforeDisplayAppointmentDialog event of UltraCalendarInfo1 I add the following:

/* Stop the default dialog from displaying */
e:Cancel = true
.

myappt = ultraCalendarInfo1:Appointments:add(input today, input "MIRA Proving Ground Diary").
myAppt:DataKey = "9999999".

myDialog = NEW Infragistics.Win.UltraWinSchedule.AppointmentDialog(UltraCalendarInfo1,myAppt,FALSE).
      
ASSIGN
myDialog:Controls:item[0]:controls:item[0]:controls:item[0]:controls:item[4]:controls:item[0]:text = ''
myDialog:Controls:item[0]:controls:item[0]:controls:item[0]:controls:item[4]:controls:item[1]:text = 'Facility'
myDialog:Controls:item[0]:controls:item[0]:controls:item[0]:controls:item[4]:controls:item[2]:text = ''
myDialog:Controls:item[0]:controls:item[0]:controls:item[0]:controls:item[4]:controls:item[3]:text = 'Customer'
myDialog:Controls:item[0]:controls:item[0]:controls:item[0]:controls:item[3]:controls:item[2]:text = 'End'
myDialog:Controls:item[0]:controls:item[0]:controls:item[0]:controls:item[3]:controls:item[3]:text = 'Start'.
       
                  
wait-for myDialog:ShowDialog().
 
myDialog:Dispose().

My dialog displays the labels correctly, but when I 'save & close', the calendar displays two appointments. Why is this?

Roger

All Replies

Posted by Admin on 17-Feb-2011 04:36

My dialog displays the labels correctly, but when I 'save & close', the calendar displays two appointments. Why is this?

 

When the event is raised, the calendar info object has already created it's own Appointment object, accessible as

e:Appointment

Try to modify this object, rather than creating your own.

So instead of

myappt = ultraCalendarInfo1:Appointments:add(input today, input "MIRA Proving Ground Diary").

use

myappt = e:Appointment.

e:Cancel just cancels the dialog to be shown, not the creation of the appointment object.

Posted by rogerholmes on 17-Feb-2011 05:05

That's greaet, many thanks for your prompt response.

Roger

This thread is closed