#13757 closed bug (no change required)
BListView Selection Boxes not Updated
Reported by: | AGMS | Owned by: | nobody |
---|---|---|---|
Priority: | normal | Milestone: | |
Component: | Kits/Interface Kit | Version: | R1/Development |
Keywords: | BListView, BListItem | Cc: | agmsmith@…, PulkoMandy |
Blocked By: | Blocking: | ||
Platform: | All |
Description
If you change a BListView's items (custom BListItems) to have different sizes (in this case it was changing a font size, making the items taller or shorter), and call Update() on all of the items to set the new width and height (the custom Update does a SetWidth() and a SetHeight()), the items get drawn with the new size but the selection rectangles for each item don't get updated (so the selection highlights are all for the previous size, and the mouse clicks are similarly off).
In BeOS it works if you call the BListView's Invalidate() function.
I got it to work in all Haiku versions by adding a dummy list item at the top of the list and then deleting it (a do-nothing FrameResized() call worked only in more recent Haiku).
So, I suggest calling the private function that updates the selection rectangles (_UpdateItems() or _RecalcItemTops()?) in the general Invalidate() call. Or maybe make it a separate function. Or should the BListItem Update() be a virtual function that does some housekeeping?
Attachments (2)
Change History (15)
by , 7 years ago
Attachment: | 0001-Recalculate-BListView-cached-selection-boxes-in-Inva.patch added |
---|
comment:1 by , 7 years ago
patch: | 0 → 1 |
---|
comment:2 by , 7 years ago
That patch to BListView::Invalidate() is a bit of a hack since Invalidate() isn't a virtual function. Anyone got a better suggestion for wedging something into Invalidate()?
by , 7 years ago
Attachment: | 0001-Update-BListItem-SetHeight-docs-with-selection-box-w.patch added |
---|
Documentation change describing work-arounds for BListItem::SetHeight() not updating the selection boxes in the BListView.
comment:3 by , 7 years ago
Rather than changing the code to fix the selection box caching problem, here's a second patch that just updates the documentation with a warning and work-around.
comment:4 by , 7 years ago
Cc: | added |
---|
I wonder: Instead of either of the solutions proposed here, perhaps we could have the BListItem call _RecalcItemTops(0)
when the size changes and remove the need to call Invalidate? Because that seems much cleaner than the solutions proposed thus far.
comment:5 by , 7 years ago
Unfortunately the BListItem doesn't know which BListView it is inside of. So it can't call _RecalcItemTops. Also can't override SetHeight(), it's not virtual. Pity.
comment:8 by , 7 years ago
patch: | 1 → 0 |
---|
comment:11 by , 6 years ago
Still a problem as of April 2019, but you could say it was resolved by documentation.
comment:12 by , 5 years ago
Resolution: | → no change required |
---|---|
Status: | new → closed |
comment:13 by , 5 years ago
Milestone: | Unscheduled |
---|
Remove milestone for tickets with status = closed and resolution != fixed
Patch to BListView::Invalidate() to also update the list items' cached selection boxes.