Is there a way to enable/disable editing of the row/col of the grid. For some reasong using attribute doesn’t work for me. I tried the following in my attempt to make some cols readonly.
attr = wx.grid.GridCellAttr()
attr.SetReadOnly(False)
for col in range(noOfCols):
if col in ReadOnlyCols:
for row in range(noOfRows):
self.grid.SetAttr(col,row,attr)
self.SetReadOnly(0,0,True) # sets the first column to read only
self.SetReadOnly(0,1,True) # sets the second column to read only
self.SetReadOnly(7,0,True) # sets the 7th row to read only.
Hope that helps.
Mike
···
-----Original Message-----
From: Ananda Regmi [mailto:aregmi@gmail.com]
Sent: Wednesday, June 27, 2007 5:32 PM
To: wxPython-users@lists.wxwidgets.org
Subject: Enable/Disable editing on a cell in wx.grid.
Greeting,
Is there a way to enable/disable editing of the row/col of
the grid. For some reasong using attribute doesn't work for
me. I tried the following in my attempt to make some cols readonly.
attr = wx.grid.GridCellAttr()
attr.SetReadOnly(False)
for col in range(noOfCols):
if col in ReadOnlyCols:
for row in range(noOfRows):
self.grid.SetAttr(col,row,attr)
Is there a way to enable/disable editing of the row/col of the grid. For some reasong using attribute doesn't work for me. I tried the following in my attempt to make some cols readonly.
attr = wx.grid.GridCellAttr()
attr.SetReadOnly(False)
for col in range(noOfCols):
if col in ReadOnlyCols:
for row in range(noOfRows):
self.grid.SetAttr(col,row,attr)
That should probably be self.grid.SetAttr(row,col,attr). Also, have you tried calling SetColAttr instead of doing it for all the rows?
···
--
Robin Dunn
Software Craftsman http://wxPython.org Java give you jitters? Relax with wxPython!