Cannot make new values show in a grid cell, even though ForceRefresh() is called.

Hi All,

I cannot make new values show in a grid cell, even though ForceRefresh() is called.

The following function is bound to EVT_GRID_CELL_CHANGE (with:
self.Bind(event=wx.grid.EVT_GRID_CELL_CHANGE, handler=self.OnGridCellChange, source=None))

The line records[row].mergeAttr(attr,new_val)is updating my data structures with new_val.

records[row].getAttrFormatted(attr)is querying my data structures for the current value - that the grid should show - in the cell that was changed.

def OnGridCellChange(self, evt):
    print "start OnGridCellChange"
    row,col = evt.GetRow(),evt.GetCol()
    old_val = self.grid.GetTable().GetValue(row,col)
    new_val = self.grid.__dict__["changed_val"]
    records = self.model.graph.getAll(self.table_name)
    attr = self.__dict__["attr_list"][self.req_table][col]
    records[row].mergeAttr(attr,new_val)
    new = records[row].getAttrFormatted(attr)
    print "167. row==",row,";col==",col,";old_val==",old_val,";new_val==",new_val,";new==",new
    self.grid.ForceRefresh()
    #evt.Skip()
    print "end OnGridCellChange"

When I change the cell value from “WWNN (node name) TBD” to “Q”, I get the following printout:

start OnGridCellChange
167. row== 0 ;col== 4 ;old_val== WWNN (node name) TBD ;new_val== Q ;new== Q
end OnGridCellChange

So, I can see that the data structures’ value was changed, but the grid cell itself is not being updated on the screen.

(I see that the new value from the cell is being updated in my data structures, because of the value in the ‘new’ variable.
Also, if I manually force a refresh to the screen, I can see the value in ‘new’ displayed in the cell.)

Can anyone suggest why ForceRefresh() is not refreshing the changed cell ?

Any suggestions would be appreciated.

Bye,

Ron.

Could you please send a running piece of code showing the problem in action?

···

2008/8/17 Barak, Ron Ron.Barak@lsi.com

Hi All,

I cannot make new values show in a grid cell, even though ForceRefresh() is called.

The following function is bound to EVT_GRID_CELL_CHANGE (with:
self.Bind(event=wx.grid.EVT_GRID_CELL_CHANGE, handler=self.OnGridCellChange, source=None))

The line records[row].mergeAttr(attr,new_val)is updating my data structures with new_val.

records[row].getAttrFormatted(attr)is querying my data structures for the current value - that the grid should show - in the cell that was changed.

def OnGridCellChange(self, evt):
    print "start OnGridCellChange"
    row,col = evt.GetRow(),evt.GetCol()
    old_val = self.grid.GetTable().GetValue(row,col)
    new_val = self.grid.__dict__["changed_val"]
    records = self.model.graph.getAll(self.table_name)
    attr = self.__dict__["attr_list"][self.req_table][col]
    records[row].mergeAttr(attr,new_val)
    new = records[row].getAttrFormatted(attr)
    print "167. row==",row,";col==",col,";old_val==",old_val,";new_val==",new_val,";new==",new
    self.grid.ForceRefresh()
    #evt.Skip()
    print "end OnGridCellChange"

When I change the cell value from “WWNN (node name) TBD” to “Q”, I get the following printout:

start OnGridCellChange
167. row== 0 ;col== 4 ;old_val== WWNN (node name) TBD ;new_val== Q ;new== Q
end OnGridCellChange

So, I can see that the data structures’ value was changed, but the grid cell itself is not being updated on the screen.

(I see that the new value from the cell is being updated in my data structures, because of the value in the ‘new’ variable.
Also, if I manually force a refresh to the screen, I can see the value in ‘new’ displayed in the cell.)

Can anyone suggest why ForceRefresh() is not refreshing the changed cell ?

Any suggestions would be appreciated.

Bye,

Ron.


wxpython-users mailing list

wxpython-users@lists.wxwidgets.org

http://lists.wxwidgets.org/mailman/listinfo/wxpython-users