forceRefresh() of wx.grid

Hello,
        I have a question concerning wx.grid...grid.table classes. I
        need to add and remove cols and rows from a grid by clicking a
        button outside the grid. So far no problem. So before I mess up
        my classes, i would like to ask, if adding or removing a column
        does internally cause a full rebuild of the whole grid, like the
        setTable()-method does, or only the specific cols and rows are
        rebuild. My problem is, that i have a lot of complex logic in
        the gridtable class. So it is easier for me to just change the
        Model and build the whole grid from scratch, than adding
        specific rows
        or cols in the model. (lot of dependencies)
        But if the grid becomes larger, the adding/removing a row/col
        might take a long time then. If only the cols and rows are
        rebuild, it will be faster, but a lot more stuff to program.
        But if the grid is rebuild anyway, i do not need to bother.
        
        I hope this is comprehensible,
        
        Thanks, Jakob

jakob fischer wrote:

Hello, I have a question concerning wx.grid...grid.table classes. I
        need to add and remove cols and rows from a grid by clicking a
        button outside the grid. So far no problem. So before I mess up
        my classes, i would like to ask, if adding or removing a column
        does internally cause a full rebuild of the whole grid, like the
        setTable()-method does, or only the specific cols and rows are
        rebuild. My problem is, that i have a lot of complex logic in
        the gridtable class. So it is easier for me to just change the
        Model and build the whole grid from scratch, than adding
        specific rows
        or cols in the model. (lot of dependencies)
        But if the grid becomes larger, the adding/removing a row/col
        might take a long time then. If only the cols and rows are
        rebuild, it will be faster, but a lot more stuff to program. But if the grid is rebuild anyway, i do not need to bother.
        
Things like this are not as smooth as they could be in the Grid classes, but it is possible. When the grid asks for the data for a particular row and column it has no idea where that data is really coming from, so the table can do pretty much whatever it wants to do. In other words, the grid may ask for (5,6) but if column 6 is supposed to be hidden then the table can just provide the data from (5,7) instead. Etc.

The tricky part is keeping the grid apprised of what shape the view is supposed to be. When the number of rows or columns changes the table needs to let the grid know about it. There is a set of grid table messages that can be used for this. See the demo and the wiki for some examples.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!