ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> wxpython-users
wxpython-users
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

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved