Ticket #18 (closed defect)
wxGrid's window calculates the content size incorrectly
| Reported by: | anonymous | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | GUI-generic | Version: | |
| Keywords: | Cc: | signwriting, vadz, neis | |
| Blocked By: | Patch: | no | |
| Blocking: |
Description
Bug#: 71
Product: .wxWindows
Version: current CVS
Platform: All
OS/Version: All
Status: ASSIGNED
Resolution:
Severity: normal
Priority: P2
Component: generic
AssignedTo: mbedward@…
ReportedBy: GregNoel@san.rr.com
URL:
Summary: A wxGrid's window calculates the content size incorrectly
The window underlying a wxGrid thinks the content is about sixteen
pixels larger than it actually is, so it is not possible to create a
wxGrid that exactly fits a surrounding panel. When one tries to do
that, scrollbars appear, even though they are not needed.
To reproduce, apply the patch below to samples/newgrid/griddemo.cpp
(all the patch does is change the size of the sample grid from 100x100
to 10x10) and compile it.
Run the program and try to resize the window so that it just surrounds
the grid. (If your screen is small, use the menu to turn off the grid
labels and select autoresize to shrink the grid as much as possible.)
If you sneak up on the grid from the right, a scrollbar will appear on
the bottom when the edge of the display area is about sixteen pixels
from the grid. A scrollbar will also appear on the right when the
window is about sixteen pixels below the bottom of the grid.
Because of this, a wxGrid cannot be used for a self-sizing display
that automatically fits itself in a panel. The scrollbars should only
be displayed when the grid cannot shrink itself enough. To make this
work correctly now takes some trickery and makes the uses of sizers
impractical.
--- griddemo.cpp Fri May 19 10:09:14 2000
+++ bugdemo.cpp Sun May 28 14:31:18 2000
@@ -206,7 +206,7 @@
// this will create a grid and, by default, an associated grid
// table for strings
- grid->CreateGrid( 100, 100 );
+ grid->CreateGrid( 10, 10 );
grid->SetRowSize( 0, 60 );
grid->SetCellValue( 0, 0, "Ctrl+Home\nwill go to\nthis cell" );
@@ -218,8 +218,8 @@
grid->SetCellValue( 0, 5, "Press\nCtrl+arrow\nto skip
over\ncells" );
- grid->SetRowSize( 99, 60 );
- grid->SetCellValue( 99, 99, "Ctrl+End\nwill go to\nthis cell" );
+ grid->SetRowSize( 9, 60 );
+ grid->SetCellValue( 9, 9, "Ctrl+End\nwill go to\nthis cell" );
grid->SetCellValue(2, 2, "red");
The patch is below:
