I am getting a python crash (not an error message but a crash) when i
try to delete a row that has any cell editor different than
wx.grid.GridCellTextEditor. Surprisingly this does not happen when i
delete a column that has a different editor.
I tried to set the cell editor in each cell in the row i want to
delete to wx.grid.GridCellTextEditor before i delete the row. the row
gets deleted but if i try to enter a value in any cell in the grid the
soft crashes again.
If i add a line to give the Grid focus after changing the editor of
the row and after deleting the row, it works once. I can delete a row
and enter new data in any cell but if i try to delete another row it
crashes again.
I stand corrected it happens also with wx.grid.GridCellTextEditor.
I can only delete rows that have no editors that were set by me.
Basically only those with the default editor that comes when the grid
is created can be deleted. i thought wx.grid.GridCellTextEditor was
the default editor no?
i am using wxpython 2.8.1.
Thanks
VC
···
On Apr 16, 12:15 am, VC <napoleon...@gmail.com> wrote:
Hi,
I am getting a python crash (not an error message but a crash) when i
try to delete a row that has any cell editor different than
wx.grid.GridCellTextEditor. Surprisingly this does not happen when i
delete a column that has a different editor.
I tried to set the cell editor in each cell in the row i want to
delete to wx.grid.GridCellTextEditor before i delete the row. the row
gets deleted but if i try to enter a value in any cell in the grid the
soft crashes again.
If i add a line to give the Grid focus after changing the editor of
the row and after deleting the row, it works once. I can delete a row
and enter new data in any cell but if i try to delete another row it
crashes again.
Ok, i found a solution.
After some reading, i learned that the celleditor is shared amon many
cells, so i figured it might be a reason why it is crashing.
What i did is call every cell editor in the row i want to delete and
destroyed the editor in it.
Now i can delete a whole row without crashing.
def OnDeleteEntry(self, evt):
index = self.Grid.GetSelectedRows()
if index:
index.sort()
for i in range(len(index)):
for col in range(self.Grid.GetNumberCols()):
x = self.Grid.GetCellEditor(i, col)
x.Destroy()
self.Grid.DeleteRows(index[-1])
del(index[-1])
self.SetStatusText('Entry Row(s) deleted')
self.Grid.ForceRefresh()
else:
pass
VC
···
On Apr 16, 12:20 am, VC <napoleon...@gmail.com> wrote:
On Apr 16, 12:15 am, VC <napoleon...@gmail.com> wrote:
> Hi,
> I am getting a python crash (not an error message but a crash) when i
> try to delete a row that has any cell editor different than
> wx.grid.GridCellTextEditor. Surprisingly this does not happen when i
> delete a column that has a different editor.
> I tried to set the cell editor in each cell in the row i want to
> delete to wx.grid.GridCellTextEditor before i delete the row. the row
> gets deleted but if i try to enter a value in any cell in the grid the
> soft crashes again.
> If i add a line to give the Grid focus after changing the editor of
> the row and after deleting the row, it works once. I can delete a row
> and enter new data in any cell but if i try to delete another row it
> crashes again.
> Any reason why this might be happening?
> VC
I stand corrected it happens also with wx.grid.GridCellTextEditor.
I can only delete rows that have no editors that were set by me.
Basically only those with the default editor that comes when the grid
is created can be deleted. i thought wx.grid.GridCellTextEditor was
the default editor no?
If you call the editor's IncRef method every time you use it for a new cell then it should take care of things for you. The crash is probably happening because the C++ object is being destroyed more than once.
···
On 4/16/12 2:12 PM, VC wrote:
On Apr 16, 12:20 am, VC<napoleon...@gmail.com> wrote:
On Apr 16, 12:15 am, VC<napoleon...@gmail.com> wrote:
Hi,
I am getting a python crash (not an error message but a crash) when i
try to delete a row that has any cell editor different than
wx.grid.GridCellTextEditor. Surprisingly this does not happen when i
delete a column that has a different editor.
I tried to set the cell editor in each cell in the row i want to
delete to wx.grid.GridCellTextEditor before i delete the row. the row
gets deleted but if i try to enter a value in any cell in the grid the
soft crashes again.
If i add a line to give the Grid focus after changing the editor of
the row and after deleting the row, it works once. I can delete a row
and enter new data in any cell but if i try to delete another row it
crashes again.
Any reason why this might be happening?
VC
I stand corrected it happens also with wx.grid.GridCellTextEditor.
I can only delete rows that have no editors that were set by me.
Basically only those with the default editor that comes when the grid
is created can be deleted. i thought wx.grid.GridCellTextEditor was
the default editor no?
i am using wxpython 2.8.1.
Thanks
VC
Ok, i found a solution.
After some reading, i learned that the celleditor is shared amon many
cells, so i figured it might be a reason why it is crashing.
What i did is call every cell editor in the row i want to delete and
destroyed the editor in it.
Now i can delete a whole row without crashing.