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:
Maarten Bent
2025-11-30 01:15:32 +01:00
parent d26f7a8575
commit b2ada524dc
+2 -3
View File
@@ -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;