mirror of
https://github.com/wxWidgets/wxWidgets.git
synced 2026-08-17 17:02:51 +08:00
Fix incorrect wxListCtrl::GetSubItemRect(n, 0)
This was broken in bde6b7a8b8.
When the list is scrolled the x-coordinate will be negative.
So don't start counting from 0, but start from the original x coordinate of the full rectangle.
This commit is contained in:
@@ -1388,16 +1388,15 @@ bool wxListCtrl::GetSubItemRect(long item, long subItem, wxRect& rect, int code)
|
||||
{
|
||||
// Because the columns can be reordered, we need to sum the widths of
|
||||
// all preceding columns to get the correct x position.
|
||||
rect.x = 0;
|
||||
for ( auto col : GetColumnsOrder() )
|
||||
{
|
||||
if ( col == 0 )
|
||||
if ( col == subItem )
|
||||
break;
|
||||
|
||||
rect.x += GetColumnWidth(col);
|
||||
}
|
||||
|
||||
rect.width = GetColumnWidth(0);
|
||||
rect.width = GetColumnWidth(subItem);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user