Exception: range is out of the bounds of this quadtree node

May 6, 2015 at 8:07 AM
Edited May 6, 2015 at 8:07 AM
I am trying to span column (like grid[0, 3].ColumnSpan=5) and get the exception "range is out of the bounds of this quadtree node". There are more than 5 columns on the right side. Previous colspans worked fine...

// 27 columns total
grid[0, 5].ColumnSpan=2; // works fine
grid[0, 7].ColumnSpan=4; // works fine
grid[0, 11].ColumnSpan=5; // exception here... but ColumnSpan=4 works!

What can cause this problem?
Coordinator
May 6, 2015 at 8:28 AM
Could you please create a unit test which reproduces this? Looks like a bug
May 6, 2015 at 8:47 AM
Edited May 6, 2015 at 8:49 AM
I have created new WinForms application and added reference to SourceGrid.dll. Then I added the Form.Load event handler:
// Just some constants from my project
private int cols_count = 5;
private int col_number = 0;
private int col_contract = 1;
private int col_period_total = 2;
private int col_period_current = 3;
private int col_period_diff = 4;

private void Form1_Load(object sender, EventArgs e)
{
    g = new Grid();
    g.Parent = this;
    g.Dock = DockStyle.Fill;
    g.RowsCount = 2;
    g.FixedColumns = cols_count;
    g.ColumnsCount = cols_count;
    // Some fixed cells
    g.Rows.Insert(0);
    g.Rows.Insert(1);
    g[0, col_number] = new SourceGrid.Cells.ColumnHeader("#");
    g[0, col_contract] = new SourceGrid.Cells.ColumnHeader("Contract");
    g[0, col_period_total] = new SourceGrid.Cells.ColumnHeader("Sum");
    g[0, col_period_current] = new SourceGrid.Cells.ColumnHeader("Out");
    g[0, col_period_diff] = new SourceGrid.Cells.ColumnHeader("Int");
    for (int i = 0; i < cols_count; i++)
        g[0, i].RowSpan = 2;
    g.Columns[col_number].Width = 30;
    g.Columns[col_contract].Width = 200;
    g.Columns[col_period_total].Width = 80;
    g.Columns[col_period_current].Width = 80;
    g.Columns[col_period_diff].Width = 80;
    for (int i = 0; i < 10; i++)
    {
        int n = cols_count + i;
        g.Columns.Insert(n);
        // Every five columns will have common header
        if (i % 5 == 0)
            g[0, n] = new SourceGrid.Cells.ColumnHeader("dep " + i.ToString());
        g[1, n] = new SourceGrid.Cells.ColumnHeader(i.ToString());
        g.Columns[n].Width = 35;
    }
    //
    // HERE I TRY TO COMBINE FIVE COLUMNS IN FIRST ROW
    // UNCOMMENT ONE OF THE FOLLOWING LINES
    //
    //g[0, 5].ColumnSpan = 4; // THIS WORKS, but one cell is not in group
    //g[0, 5].ColumnSpan = 5; // THIS WON'T, crashes with exception
}
Maybe I just do something wrong here... but I stuck with this exception for two days already... I use VS 2012 Express for Desktop.