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:
Vadim Zeitlin 2003-08-21 23:08:10 +00:00
parent e9c0df38e7
commit 1e54be64fd

View File

@ -3778,6 +3778,13 @@ void wxListMainWindow::GetItemRect( long index, wxRect &rect ) const
wxCHECK_RET( index >= 0 && (size_t)index < GetItemCount(),
_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);
CalcScrolledPosition(rect.x, rect.y, &rect.x, &rect.y);