Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Tutorial 4. clarification (Read 5614 times)
gerardo
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 27
Joined: Jan 26th, 2007
Tutorial 4. clarification
Feb 5th, 2007 at 4:40pm
Print Post  
I'm working creating my own custom schedule item class like in the tutorial 4, so let me use the tutorial to expain my question.

The property _kept is initialized TRUE in the constructor.

So using the code below(change Kept to false), everytime the user clicks the appointment the message text is showing:


This is our item!. Kept is True.

when the value for Kept must be false.

If I remove the recurrent part of the code the value will be false as expected but for recurrent appointments probably I'm missing something in the code.

Thanks in advance for any help.


Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

Schedule.RegisterItemClass(GetType(MyApp), "myapp", 1)

calendar.InteractiveItemType = GetType(MyApp)

'added by gerardo

Dim newapp As MyApp
newapp = New MyApp
newapp.DescriptionText = "TEst 01"
newapp.HeaderText = "header 01"
newapp.Kept = False
newapp.StartTime = New DateTime(2007, 2, 5, 8, 0, 0)
newapp.EndTime = New DateTime(2007, 2, 5, 10, 30, 0)

Dim rec As Recurrence = New Recurrence
rec.Pattern = RecurrencePattern.Daily
rec.StartDate = New DateTime(2007, 1, 10)

rec.RecurrenceEnd = RecurrenceEnd.Never

newapp.Recurrence = rec

calendar.Schedule.Items.Add(newapp)
calendar.Date = New Date(2007, 2, 5)

End Sub

Private Sub calendar_ItemClick(ByVal sender As Object, ByVal e As MindFusion.Scheduling.WinForms.ItemMouseEventArgs) Handles calendar.ItemClick

If TypeOf e.Item Is MyApp Then
Dim myAppointment As MyApp
myAppointment = e.Item
calendar.ResetDrag()
MessageBox.Show("This is our item!. Kept is " + myAppointment.Kept.ToString())

End If



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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Tutorial 4. clarification
Reply #1 - Feb 5th, 2007 at 5:00pm
Print Post  
Further down in tutorial 4 there is a part about recurrences, that shows how to implement cloning of custom fields -

Code
Select All
protected override void CopyOccurrence(Item master)
{
	base.CopyOccurrence(master);

	kept = (master as MyApp).Kept;
}
 



Stoyan
  
Back to top
 
IP Logged
 
gerardo
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 27
Joined: Jan 26th, 2007
Re: Tutorial 4. clarification
Reply #2 - Feb 5th, 2007 at 5:08pm
Print Post  
I read that part.

and If you replace the code in the tutorial for the methods:

Form1_Load
calendar_ItemClick

with the code that I provided in the original post, your will understand my question, because I use the class MyApp as is definided in the tutorial including the method: CopyOccurrence
  
Back to top
 
IP Logged
 
gerardo
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 27
Joined: Jan 26th, 2007
Re: Tutorial 4. clarification
Reply #3 - Feb 5th, 2007 at 5:16pm
Print Post  
this is the implementation on MyApp that I'm using for CopyOcurrence:

    Protected Overloads Sub CopyOccurrence(ByVal master As Item)

       MyBase.CopyOccurrence(master)

       _kept = CType(master, MyApp).Kept

    End Sub
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Tutorial 4. clarification
Reply #4 - Feb 5th, 2007 at 5:27pm
Print Post  
Try defining the method with the Overrides keyword instead of Overloads.

Stoyan
  
Back to top
 
IP Logged
 
gerardo
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 27
Joined: Jan 26th, 2007
Re: Tutorial 4. clarification
Reply #5 - Feb 5th, 2007 at 5:40pm
Print Post  
That was the problem.... Thanks. Smiley
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Tutorial 4. clarification
Reply #6 - Feb 5th, 2007 at 5:46pm
Print Post  
8)
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint