IEditableObject CancelEdit questions

IEditableObject CancelEdit questions

Old forum URL: forums.lhotka.net/forums/t/1813.aspx


Massong posted on Wednesday, November 22, 2006

Hi all,

A few weeks ago I posted about a problem adding new items to a Component One TrueDataGrid (http://forums.lhotka.net/forums/post/7727.aspx): Pressing ESC to cancel adding gets the application crash with a StackOverflowException.

Yesterday I found out, that commenting out the following methods in the BusinessBase class solves this problem:

Private Sub IEditableObject_BeginEdit() _
      Implements System.ComponentModel.IEditableObject.BeginEdit
Private Sub IEditableObject_CancelEdit() _
      Implements System.ComponentModel.IEditableObject.CancelEdit
Private Sub IEditableObject_EndEdit() _
      Implements System.ComponentModel.IEditableObject.EndEdit

Additional to the StackOverflowExcetion we had another strange behaviour of the grid when adding items that has gone after commenting that methods out:

• Click into the AddNew row to add a first row to an empty grid
• Enter no data
• Click into empty space of the grid to cancel adding
• The first row is removed without problems

But:

• Add a first row to the grid
• Add a second row to the grid and enter no data
• Click into empty space of the grid to cancel adding the second row
• The grid turns white with a red cross and the following exception is thrown whenever the mouse is moved over the grid:

Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index

   at System.Collections.ArrayList.get_Item(Int32 index)
   at C1.Win.C1TrueDBGrid.BaseGrid.ViewRowList.get_Item(Int32 index)
   at C1.Win.C1TrueDBGrid.BaseGrid.View.chooseCursor(Point p)
   at C1.Win.C1TrueDBGrid.BaseGrid.View.OnMouseMove(MouseEventArgs e)
   at cd.c(MouseEventArgs A_0)
   at C1.Win.C1TrueDBGrid.BaseGrid.Frame.doMouseMove(MouseEventArgs e)
   at C1.Win.C1TrueDBGrid.C1TrueDBGrid.doMouseMove(MouseEventArgs e)
   at C1.Win.C1TrueDBGrid.BaseGrid.Frame.OnMouseMove(MouseEventArgs e)
   at System.Windows.Forms.Control.WmMouseMove(Message& m)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at C1.Win.C1TrueDBGrid.C1TrueDBGrid.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

My questions are:

• Does anybody else use the TrueDataGrid? Have you any problems with the grid?
• Are there known issues with the IEditableObject-implementation? Especially with the IEditableObject.CancelEdit? I remember I read something about problems with the Janus Grid...?
• Can I leave this methods commented out without getting other problems?

Thanks for help!

RockfordLhotka replied on Wednesday, November 22, 2006

One common request is to have a switch on BusinessBase that allows the IEditableObject support to be turned off - for this very reason. Some 3rd party grids just don't seem to properly interact with this interface...

That switch would be the equivalent of commenting out the interface implementation, so if commenting it out works for you then so be it Smile [:)]

Massong replied on Thursday, November 23, 2006

Hi Rocky,

Thank you very much. Clicking into the wrong place of the grid was very frustrating - when a lot of data had been entered...

Copyright (c) Marimer LLC