ensure that GetItemRect() returns the real rect and not 0 even if it's called before first OnIdle()
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@23084 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -3778,6 +3778,13 @@ void wxListMainWindow::GetItemRect( long index, wxRect &rect ) const
|
|||||||
wxCHECK_RET( index >= 0 && (size_t)index < GetItemCount(),
|
wxCHECK_RET( index >= 0 && (size_t)index < GetItemCount(),
|
||||||
_T("invalid index in GetItemRect") );
|
_T("invalid index in GetItemRect") );
|
||||||
|
|
||||||
|
// ensure that we're laid out, otherwise we could return nonsense
|
||||||
|
if ( m_dirty )
|
||||||
|
{
|
||||||
|
wxConstCast(this, wxListMainWindow)->
|
||||||
|
RecalculatePositions(TRUE /* no refresh */);
|
||||||
|
}
|
||||||
|
|
||||||
rect = GetLineRect((size_t)index);
|
rect = GetLineRect((size_t)index);
|
||||||
|
|
||||||
CalcScrolledPosition(rect.x, rect.y, &rect.x, &rect.y);
|
CalcScrolledPosition(rect.x, rect.y, &rect.x, &rect.y);
|
||||||
|
Reference in New Issue
Block a user