Opened 19 months ago

Closed 18 months ago

Last modified 18 months ago

#14947 closed defect (fixed)

wxGrid hidden colums can be made visible by using the drag resize feature

Reported by: hackish Owned by: vadz
Priority: normal Milestone:
Component: wxGrid Version: stable-latest
Keywords: wxGrid Cc:
Blocked By: Blocking:
Patch: yes

Description

Not really sure why this happens but if you create a grid with 3 rows, 3 cols, call HideCol(1) you can still resize the hidden column and view it. I suspect the code itself should ignore a row or column with a negative size (as it's hidden). I probably won't have the time to build a patch for this but here is the report for anyone else with time.

Attachments (2)

grid.patch download (2.4 KB) - added by hackish 19 months ago.
Modifications to the sample to show the fault
gridfix1.patch download (2.2 KB) - added by hackish 19 months ago.

Download all attachments as: .zip

Change History (10)

comment:1 Changed 19 months ago by vadz

What platform is this? I am almost sure I tested this after the recent changes in HideCol() code and it worked (i.e. didn't resize anything) correctly.

As always, having a minimal patch reproducing the problem in the grid sample (if it can't be already reproduced in it out of the box?) would be very welcome.

comment:2 Changed 19 months ago by hackish

  • Component changed from base to wxGrid

Platform is MSW. I'll see what I can do to build a test case. Maybe even do a patch for it :)

comment:3 Changed 19 months ago by hackish

Here are the steps.

Apply the above patches to the latest SVN sample code for grid.
Select the Hide Col A menu option.
Drag column to the left of column B to enlarge it. Column A will reappear.

Changed 19 months ago by hackish

Modifications to the sample to show the fault

comment:4 Changed 19 months ago by hackish

  • Patch set
  • Status changed from new to confirmed

See the attached patch. wxGrid::PosToEdgeOfLine was not properly checking the visibility of the cell before it and blindly assuming if the found cell didn't match then the one before it must. It now continues to traverse every hidden cell before a non-matching entry then re-checks before returning -1. I've tested this as many ways as I could to ensure it doesn't introduce any other unwanted behaviour.

Changed 19 months ago by hackish

comment:5 Changed 18 months ago by vadz

  • Owner set to vadz
  • Status changed from confirmed to accepted

Thanks, the patch looks correct but I think it could be simplified a little by merging the identical checks before and inside the loop. I'll do it, but please retest and let me know if you find any problem with my changes. Thanks again!

comment:6 Changed 18 months ago by hackish

There was a reason why the checks shouldn't be combined but I'd have to look at it again. Let me know when you've committed your version and I'll figure it out again.

comment:7 Changed 18 months ago by VZ

  • Resolution set to fixed
  • Status changed from accepted to closed

(In [73399]) Fix bug with showing hidden wxGrid lines when resizing an adjacent one.

Don't blindly assume that the previous line is big enough if the current one
isn't in wxGrid::PosToEdgeOfLine() (this assumption is wrong even without
taking hiding into account...).

Closes #14947.

comment:8 Changed 18 months ago by VZ

(In [73460]) Really fix resizing of wxGird column/rows after a hidden one.

The previous fix (r73399) broke resizing from the side of the preceding grid
line, restore the old code and just add a loop finding the first visible line
before the one being clicked.

See #14947.

Note: See TracTickets for help on using tickets.