Jun 15, 2009 at 1:56 PM

I have issue with the new overlappingcellexpection behaviour.

This is the logic:

1) Build a grid and initialize every cell

2) start popping stuff on the grid, soon as you want to add an item that has a span, it will throw an exception.

So now, I have to (before adding a new cell) look to see if any other cell it near and delete it .....

Was this on purpose? Before you could have overlapping cells. Should we make this an toggle option? (Allow overlapping cells)

What do you guys think?


Jun 15, 2009 at 8:19 PM

At least in my use cases I usually inicialize grid knowing and/or calculating spaning. But possibly there could be option to automatically delete cells that fall under spanned cell but only if they do not already have row/column span for these cells. But anyway such option should be optional and should default to false.

Jun 16, 2009 at 12:11 AM
I agree. Right now I just itterate through what would be the "spanned" cells and make them null, then add the span ... just seems a bit backwards ... now what I mean?

On Mon, Jun 15, 2009 at 4:19 PM, Lafriks <notifications@codeplex.com> wrote:

From: Lafriks

At least in my use cases I usually inicialize grid knowing and/or calculating spaning. But possibly there could be option to automatically delete cells that fall under spanned cell but only if they do not already have row/column span for these cells. But anyway such option should be optional and should default to false.

Read the full discussion online.

To add a post to this discussion, reply to this email (sourcegrid@discussions.codeplex.com)

To start a new discussion for this project, email sourcegrid@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com

Jun 16, 2009 at 5:27 AM

Okay, that is not the most elegant way to work with grid.

I agree with both of you. My proposal would be to have an option, which automatically deletes cells. It could be automatically set to "true", but with these rule applied also:

 * only cells which do not have spanning can be automatically deleted (overwritten). If cell is already with spann, then throw Overlapping exception.

What do you think about this behaviour?


Jul 2, 2009 at 3:06 PM


I Think I haven't understood how to do to avoid this problem because I'm having the same exception:


SourceGrid.OverlappingCellException was unhandled
  Message="Can not change column span"
       at SourceGrid.Cells.Cell.set_ColumnSpan(Int32 value)
       at swisstopo.geodesy.fileeditor.GridEdit.LoadLine(Int32 gridRow) in D:\PROJECTS\VS2005\FileEditor\VS.NET\Control\GridEdit.cs:line 646
       at swisstopo.geodesy.filemanager.FileWindow.ReloadFile() in D:\PROJECTS\VS2005\FileEditor\VS.NET\FileManager\FileWindow.cs:line 157
       at swisstopo.geodesy.filemanager.MainForm.OpenFile(String filename, String template) in D:\PROJECTS\VS2005\FileEditor\VS.NET\FileManager\MainForm.cs:line 104
       at swisstopo.geodesy.filemanager.FileWindow.mnuCtxtFileReload_Click(Object sender, EventArgs e) in D:\PROJECTS\VS2005\FileEditor\VS.NET\FileManager\FileWindow.cs:line 406
       at System.Windows.Forms.ToolStripItem.RaiseEvent(Object key, EventArgs e)
       at System.Windows.Forms.ToolStripMenuItem.OnClick(EventArgs e)
       at System.Windows.Forms.ToolStripItem.HandleClick(EventArgs e)
       at System.Windows.Forms.ToolStripItem.HandleMouseUp(MouseEventArgs e)
       at System.Windows.Forms.ToolStripItem.FireEventInteractive(EventArgs e, ToolStripItemEventType met)
       at System.Windows.Forms.ToolStripItem.FireEvent(EventArgs e, ToolStripItemEventType met)
       at System.Windows.Forms.ToolStrip.OnMouseUp(MouseEventArgs mea)
       at System.Windows.Forms.ToolStripDropDown.OnMouseUp(MouseEventArgs mea)
       at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
       at System.Windows.Forms.Control.WndProc(Message& m)
       at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
       at System.Windows.Forms.ToolStrip.WndProc(Message& m)
       at System.Windows.Forms.ToolStripDropDown.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.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
       at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
       at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
       at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
       at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
       at System.Windows.Forms.Application.Run(Form mainForm)
       at swisstopo.geodesy.filemanager.Program.Main() in D:\PROJECTS\VS2005\FileEditor\VS.NET\FileManager\Program.cs:line 34
       at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
       at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()


What I'm trying to do is replace a row with another.


I'v tried with the following command to set all the cells to null:

            for (int col = 0; col < grid.ColumnsCount; col++)
                grid[gridRow, col] = null;


But I'm still having an OverlappingCellException when I try to set .ColumnSpan on a Row where there previously was a Spanned Cell.

And if I ignore the ColumnSpan property (and so should have empty cells), the Grid is displayed as a big red cross and then I've a fatal error.

How should I properly clear a row ?


Jul 2, 2009 at 3:15 PM
Edited Jul 2, 2009 at 4:01 PM

I also tried to loop in the cells with "grid[row, col].ColumnSpan = 1", "grid[row, col] = null" or "grid[gridRow, col] = new SourceGrid.Cells.Cell()" by I always get a NullReferenceException.

I noticed that if I use InsertRow with an index where a row with spanned cells exists, it crashes.
I get such a message: "{"Given cell at position (14, 2), intersects with another cell at position (15, 2) 'Test'"}".

There is a conflict between the previous cell which is now at the index 15 and the new one at index 14. Something shouldn't be correctly updated when inserting rows.

So it's not only a creation/deletion problem.

If I create the row at the end of my Grid and use Row.Move() at the end to move it where I want, I've a crash with NullException at "Application.Run(...)" !



OK, I think I understood. Unfortunately I can't really debug,m because the code isn't compatible with VS 2005.

But I'v made some tests and according what is said above, if I understand correctly, the spanned cells (the ones which are "hidden/overlapped" by the one with ColumnSpan>1) are set "grid[r, c] = null".

I also noticed that if one of the cells which has to be overlapped has benne previously set (grid[r, c]  = new SourceGrid.Cells.Cell()), we get an OverlappingCellException.

The problem is what can I do if I want to edit this cell later and make it not spanned any more: .ColumnSpan = 1 works, but the problem comes when I want to set/edit the cells which were hidden. I can't access to it any more, because they are set to null! "grid[r, c]" returns a NullException and I can't do anything with this cell.

Same problem with "grid.SetCell(r, c, new SourceGrid.Cells.Cell())". How can I recreate/reset the cell (or row, but grid.Rows[r] is ReadOnly) ?


Jul 3, 2009 at 7:30 AM

Oop, sorry for the "false alert" !

I thought I had the latest version, but it seems to not be true, because it works without Exception with the last trunk version...

So it has been corrected and you can forget my question/bug report :)

(and I will soon have a new IDE installed and so I will be able do run SourceGrid in debug mode, so I will be able to find out what I'm doing wrong or where is the problem more efficiently!)

Jul 5, 2009 at 6:58 AM