Discussion:
Application crashes after wxGrid->DeleteRows call
Serge Stakhanov
2014-06-10 17:49:58 UTC
Permalink
Hello in my application I use wxGrid control, if I delete rows in this
wxGrid, my application is crashing and I got error message:
"../../src/generic/grid.cpp(7445): assert "row >= 0 && row < m_numRows"
failed in GetRowSize(): invalid row index ". Yes I call GetRowSize() in my
app too. My release wxGTK-3.0.0 but this error I got on 2.9.5 too. How to
get around this error?
Thanks in advance.
--
Please read http://www.wxwidgets.org/support/mlhowto.htm before posting.

To unsubscribe, send email to wx-users+***@googlegroups.com
or visit http://groups.google.com/group/wx-users
Stewart Douglas
2014-06-10 18:58:18 UTC
Permalink
Have you by any chance deleted all the rows in the grid - I have a
feeling you need to leave the header row in there ?
Post by Serge Stakhanov
Hello in my application I use wxGrid control, if I delete rows in this
"../../src/generic/grid.cpp(7445): assert "row >= 0 && row <
m_numRows" failed in GetRowSize(): invalid row index ". Yes I call
GetRowSize() in my app too. My release wxGTK-3.0.0 but this error I
got on 2.9.5 too. How to get around this error?
Thanks in advance.
--
Please read http://www.wxwidgets.org/support/mlhowto.htm before posting.
or visit http://groups.google.com/group/wx-users
--
Stewart Douglas
***@snowgold.com
http://www.snowgold.com
--
Please read http://www.wxwidgets.org/support/mlhowto.htm before posting.

To unsubscribe, send email to wx-users+***@googlegroups.com
or visit http://groups.google.com/group/wx-users
Igor Korot
2014-06-10 19:15:16 UTC
Permalink
Hi, Serge,

On Tue, Jun 10, 2014 at 10:49 AM, Serge Stakhanov
Post by Serge Stakhanov
Hello in my application I use wxGrid control, if I delete rows in this
"../../src/generic/grid.cpp(7445): assert "row >= 0 && row < m_numRows"
failed in GetRowSize(): invalid row index ". Yes I call GetRowSize() in my
app too. My release wxGTK-3.0.0 but this error I got on 2.9.5 too. How to
get around this error?
Can you post the offending code, please?

Thank you.
Post by Serge Stakhanov
Thanks in advance.
--
Please read http://www.wxwidgets.org/support/mlhowto.htm before posting.
or visit http://groups.google.com/group/wx-users
--
Please read http://www.wxwidgets.org/support/mlhowto.htm before posting.

To unsubscribe, send email to wx-users+***@googlegroups.com
or visit http://groups.google.com/group/wx-users
Serge Stakhanov
2014-06-11 15:07:50 UTC
Permalink
Hello Stewart, Igor.

I delete not all the rows in the grid, just 5-8 in the middle of the grid.


In my app I call GetRowSize in 3 functions, here is the code:

int wxMyGrid::GetAllRowsHeight()
{
int rowTotalHeight = 0;

int numrows = this->GetNumberRows();

if ( numrows >= 0)
{
for (int row = 0; row < numrows; row++ )
{
rowTotalHeight += this->GetRowSize(row);
}
}

return rowTotalHeight;
}

int wxMyGroupButton::GetRowTopToGridCorner(int row)
{
int rowTotalHeight = 0;

if (row >= 0)
{
for (int i = 0; i < row; i++ )
{
rowTotalHeight += _grid->GetRowSize(i);
}
}

return (rowTotalHeight - _grid->GetRowSize(row));

}



int wxMyGroupButton::GetRowBottomToGridCorner(int row)
{
int rowTotalHeight = 0;

if (row >= 0)
{
for (int i = 0; i < row; i++ )
{
rowTotalHeight += _grid->GetRowSize(i);
}
}
return rowTotalHeight;

}

But it seams to me the issue is not in my code, wxGrid doesn't refresh
m_rowHeights array after I deleted rows.
--
Please read http://www.wxwidgets.org/support/mlhowto.htm before posting.

To unsubscribe, send email to wx-users+***@googlegroups.com
or visit http://groups.google.com/group/wx-users
Loading...