Ticket #19 (closed defect)
wxGrid flickers due to unnecessary repaints
| Reported by: | anonymous | Owned by: | vadz |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | wxGTK | Version: | |
| Keywords: | Cc: | vadz | |
| Blocked By: | Patch: | no | |
| Blocking: |
Description
Bug#: 72
Product: .wxWindows
Version: current CVS
Platform: wxGTK
OS/Version: All
Status: NEW
Resolution:
Severity: normal
Priority: P2
Component: generic
AssignedTo: ???
ReportedBy: GregNoel@san.rr.com
URL:
Summary: wxGrid flickers due to unnecessary repaints
The ugly patch below modifies samples/newgrid/griddemo.cpp to log a
message if the grid is repainted more than once in four seconds. In
an ideal world, this message would never be triggered. However, in
the current code, there are a number of things that will trigger
multiple repaints.
Resizing. If your window manager has a way of doing a jump-rescale
(such as maximize window or maximize height), this will trigger either
one or two unnecessary repaints.
Selection. Double-click on "a weird looking cell" (the one that's
doing the reporting). Then click on another cell. An excess repaint
is generated.
Data refill. I can trigger this one in my own code, but there isn't a
similar circumstance in the griddemo. It may be one of the two
previous cases, since I am resizing and selecting the grid, but I
suspect it's something else. If the two previous cases can be fixed,
I'll check it again.
Here's the patch to griddemo.cpp:
--- .src/griddemo.cpp Fri May 19 10:09:14 2000
+++ .src/flickerdemo.cpp Tue May 30 01:40:20 2000
@@ -202,7 +202,7 @@
logger = new wxLogTextCtrl( logWin );
m_logOld = logger->SetActiveTarget( logger );
- logger->SetTimestamp( NULL );
+ //logger->SetTimestamp( NULL );
// this will create a grid and, by default, an associated grid
// table for strings
@@ -772,6 +772,10 @@
int row, int col,
bool isSelected)
{
+{ static time_t tyme = 0; time_t t = time(0);
+if (tyme + 4 < t) tyme = t; else
+// set break on next line to see where it's happening...
+wxLogMessage("REPAINTING MY CELL"); }
wxGridCellStringRenderer::Draw(grid, attr, dc, rect, row, col,
isSelected);
dc.SetPen(*wxGREEN_PEN);
