Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic ArgumentOutOfRangeException in ItemClick Event (Read 5054 times)
Pallis
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 12
Joined: Sep 17th, 2007
ArgumentOutOfRangeException in ItemClick Event
Sep 17th, 2007 at 5:51am
Print Post  
Good morning,

I am in a process of evaluating Pocket Planner so that i can buy it when i see that it works normally. Therefore i have come againist a strange problem : I am handling the ItemClicked Event with this simple code :

    Private Sub Calendar1_ItemClick(ByVal sender As Object, ByVal e As MindFusion.Scheduling.Compact.ItemMouseEventArgs) Handles Calendar1.ItemClick

       MsgBox(e.Item.DescriptionText)

    End Sub

When msgbox appears and i click OK in the messagebox window then i get an exception in my form designer :

System.ArgumentOutOfRangeException was unhandled
  Message="ArgumentOutOfRangeException"
  StackTrace:
    in System.PInvoke.EE.Array_Copy()
    in System.Array.Copy()
    in MindFusion.SortedList.Insert()
    in MindFusion.SortedList.Add()
    in MindFusion.Scheduling.Schedule.GetAllItems()
    in MindFusion.Scheduling.Compact.Calendar.GetAllItems()
    in MindFusion.Scheduling.Compact.ScheduleColumnCell.Draw()
    in MindFusion.Scheduling.Compact.Cell.Draw()
    in MindFusion.Scheduling.Compact.ScheduleCell.Draw()
    in MindFusion.Scheduling.Compact.Calendar.OnPaint()
    in System.Windows.Forms.Control.WnProc()
    in System.Windows.Forms.Control._InternalWnProc()
    in Microsoft.AGL.Forms.EVL.EnterMainLoop()
    in System.Windows.Forms.Application.Run()
    in RDSCRMMobile.frmMain.Main()

What am i doing wrong? This is a very simple code.

Additionally i would like to ask why you didn't include a DoubleClick event with the item? Imagine a user that clicks an appoitment just to select it or to move it. He doesn't want that time to open a form to edit the appointment. So, how can i open a form (my form of appointment) for editing to the user when he double clicks the appointment? Is there any way to do this?

Thank you very much for your answer, and sorry for my english. I would appreciate your fast answer because we are very hurry to start our project, we are commited to our clients, and the only control that fits our demands is your control !! Thank you again !!

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


MindFusion support

Posts: 1783
Joined: Jul 20th, 2005
Re: ArgumentOutOfRangeException in ItemClick Event
Reply #1 - Sep 17th, 2007 at 7:08am
Print Post  
Hello,

This exception is a bug and should not happen. From the stack trace I presume you are using the Timetable view. I am trying to reproduce this bug here but I am not successful. Can you supply me with your initialization code and with other information, such as your .NET CF version and the version of PocketPlanner you are using? Meanwhile, can you try invoking Calendar.ResetDrag method just before displaying the message box to the user, and see if the exception is still thrown?

Code
Select All
...
calendar.ResetDrag();
MessageBox.Show(...);
... 


As for the DoubleClick event, it seems that the .NET Compact Framework does not provide such information in the Mouse events, so there is no way we could tell whether the user clicked once or twice.

Meppy
  
Back to top
 
IP Logged
 
Pallis
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 12
Joined: Sep 17th, 2007
Re: ArgumentOutOfRangeException in ItemClick Event
Reply #2 - Sep 17th, 2007 at 7:23am
Print Post  
Hello Meppy and thank you for your rapid answer.

I am using Timetable View.

The Init code of the form for the control is the following :

       '
       'Calendar1
       '
       Me.Calendar1.CurrentView = MindFusion.Scheduling.Compact.CalendarView.Timetable
       Me.Calendar1.Date = New Date(2007, 9, 14, 0, 0, 0, 0)
       Me.Calendar1.EndDate = New Date(2007, 10, 14, 0, 0, 0, 0)
       Me.Calendar1.Location = New System.Drawing.Point(0, 0)
       Me.Calendar1.Name = "Calendar1"
       Me.Calendar1.Size = New System.Drawing.Size(240, 240)
       Me.Calendar1.TabIndex = 0
       Me.Calendar1.Theme = MindFusion.Scheduling.Compact.ThemeType.LightBlue

The NetCF Version is 2.0.6129.0

PocketPlanner Version is 4.2.1.0

I have also tested your suggestion with ResetDrag but i get the same exception.

I am waiting for your answer. Thank you again !!


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


MindFusion support

Posts: 1783
Joined: Jul 20th, 2005
Re: ArgumentOutOfRangeException in ItemClick Event
Reply #3 - Sep 17th, 2007 at 8:30am
Print Post  
Still, the bug doesn't happen at my place. Some more questions follow: How do you create the item? If you create it programmatically, can you send me the code that creates and initializes it? If you create it interactively, can you supply me with the start and end time of the item before it is clicked. Also, if you handle any other events or perform any other PocketPlanner-related operations, it will be most useful if you let me know about them.

Thank you,
Meppy
  
Back to top
 
IP Logged
 
Pallis
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 12
Joined: Sep 17th, 2007
Re: ArgumentOutOfRangeException in ItemClick Event
Reply #4 - Sep 17th, 2007 at 8:36am
Print Post  
This is the testing code with the creation of the object (it happens at Form Activate Event) :


'CALENDAR TEST



Calendar1.TimetableSettings.Dates.Clear()



For i As Int16 = 0 To 5


Calendar1.TimetableSettings.Dates.Add(DateTime.Today + New TimeSpan(i, 0, 0, 0))


Next


Calendar1.TimetableSettings.VisibleColumns = 3



Calendar1.EndInit()



Calendar1.TimetableSettings.CellSize = Calendar1.TimetableSettings.CellSize * (Me.Height / 320) * 2



Calendar1.TimetableSettings.TimelineSize = Calendar1.TimetableSettings.TimelineSize * (Me.Height / 320)



Calendar1.BeginInit()


Dim s As New MindFusion.Scheduling.Appointment



s.Id = "210921"


s.HeaderText = "Bill Gates"


s.DescriptionText = "Meeting with Bill"


s.StartTime = New DateTime(2007, 9, 17, 13, 30, 0)


s.EndTime = New DateTime(2007, 9, 17, 16, 30, 0)



Calendar1.Schedule.Items.Add(s)



s = New MindFusion.Scheduling.Appointment


s.Id = "29823"


s.HeaderText = "Secretary"


s.DescriptionText = "Meeting with my Secretary"


s.StartTime = New DateTime(2007, 9, 17, 16, 0, 0)


s.EndTime = New DateTime(2007, 9, 17, 18, 30, 0)


s.Style.FillColor = Color.Gold


Calendar1.Schedule.Items.Add(s)

Also i noticed that even when a do anything in the handler routine (ItemClicked), not only msgbox (e.g. when i try to raise a form dialog), when the sub finished i get the same exception. Only when the handler sub is empty, it works properly...

  
Back to top
 
IP Logged
 
Pallis
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 12
Joined: Sep 17th, 2007
Re: ArgumentOutOfRangeException in ItemClick Event
Reply #5 - Sep 17th, 2007 at 8:43am
Print Post  
I found it !! When i described the problem in the last answer i said : IN THE FORM_ACTIVATED EVENT !! That's the problem. The code of the activated event fires after the ItemClicked Event to repaint, so it tries to add 2 items with the same ID and the same attributes. I replaced the code and put it in form_load and it's OK.

Eventually i found a way for a double click event :

In Form Class i put a variable :

Private PreviousClickTime As Integer = SystemInformation.DoubleClickTime


And i modify the ItemClicked Event like this :

    Private Sub Calendar1_ItemClick(ByVal sender As Object, ByVal e As MindFusion.Scheduling.Compact.ItemMouseEventArgs) Handles Calendar1.ItemClick

       Dim NowTime As Integer

       NowTime = System.Environment.TickCount

       If NowTime - PreviousClickTime <= SystemInformation.DoubleClickTime Then
            'Code here for double click
       End If

       PreviousClickTime = NowTime

    End Sub


I will continue the tests and i will let you know.

Thank you anyway !!!

  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint