Re: [wxPython-users] Binding grid and data ?
by Stephen Hansen other posts by this author
Jun 30 2007 7:51PM messages near this date
[wxPython-users] Binding grid and data ?
|
Re: [wxPython-users] Binding grid and data ?
> So is there a real binding between the grid and data ?
> Should I write changing values directly to the grid ?
> Or any other suggestions ?
What I would do is write directly to the table-- but you will have to
provide an API for this. The table doesn't manage how you -store- your data,
it just provides a consistent API for the grid to -ask- the table what data
is where.
You can add to your table subclass "SetValue(row, col, value)", and then
update your storage.
The grid then has to be told that the table has had changes made to it. You
can create an 'UpdateValues' method of your table subclass, such as:
import wx.grid as gridlib
...
def UpdateValues(self):
msg = gridlib.GridTableMessage(self,
gridlib.GRIDTABLE_REQUEST_VIEW_GET_VALUES)
self.MyGrid.ProcessTableMessage(msg)
That's assuming your table is storing a reference to the grid in "
self.MyGrid". I'd have the "SetValue" method of your table automatically
call self.UpdateValues() then.
--S
Thread:
Stef Mientki
Stephen Hansen
Stef Mientki
Stephen Hansen
|