[wxPython-users] How can a cell renderer refresh adjacent cells?
Grzegorz Adam Hankiewicz
ghankiewicz at rastertech.es
Mon Jun 4 01:39:44 PDT 2007
Robin Dunn wrote:
> Grzegorz Adam Hankiewicz wrote:
>> Is there any way to do what I want (ie. refresh adjacent cells)?
>
> You can use CellToRect to get the rectangle of each cell you want to
> refresh, and then pass that rectangle to Refresh() or RefreshRect().
> Then the next paint event will include that area in its update region
> and it won't be clipped. You may need to adjust the rectangle for
> scrolled position, and you may need to call the
> grid.GetGridWindow().Refresh(...) instead of grid.Refresh(...), although
> I seem to recall that grid refreshes get passed on to the component
> windows so it may not be necessary.
Turns out forcing a refresh wasn't good at all. It only works when you
click on the scrollbar, not when you drag (I presume I would have to
adjust here the position to compensate the dragging), plus I got
sometimes permanent flickering due to cells looping infinitely over a
refresh/draw cycle, possibly due to incorrect screen coordinates
calculations.
I solved it in another way: get the rect position of the adjacent cell
which I consider the 'master', then draw everything using its position
but clipping to the region passed to the cell renderer. This works
really nice.
--
Rastertech España S.A.
Grzegorz Adam Hankiewicz
/Jefe de Producto TeraVial/
C/ Perfumería 21. Nave I. Polígono industrial La Mina
28770 Colmenar Viejo. Madrid (España)
Tel. +34 918 467 390 (Ext.17) *·* Fax +34 918 457 889
ghankiewicz at rastertech.es *·* www.rastertech.es
<http://www.rastertech.es/>
More information about the wxpython-users
mailing list