List Info

Thread: Enable/Disable editing on a cell in wx.grid.




Enable/Disable editing on a cell in wx.grid.
user name
2007-06-27 17:31:38
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)

Any suggestions.

Appreciate your help.

Ananda


RE: Enable/Disable editing on a cell in wx.grid.
country flaguser name
United States
2007-06-28 08:18:15
 

> -----Original Message-----
> From: Ananda Regmi [mailto:aregmigmail.com] 
> Sent: Wednesday, June 27, 2007 5:32 PM
> To: wxPython-userslists.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)
> 
> Any suggestions.
> 
> Appreciate your help.
> 
> Ananda
> 

In my grid class, I just do the following:

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


------------------------------------------------------------
---------
To unsubscribe, e-mail: wxPython-users-unsubscribelists.wxwidgets.org
For additional commands, e-mail: wxPython-users-helplists.wxwidgets.org


[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )