]> git.saurik.com Git - wxWidgets.git/commitdiff
ensure that GetItemRect() returns the real rect and not 0 even if it's called before...
authorVadim Zeitlin <vadim@wxwidgets.org>
Thu, 21 Aug 2003 23:08:10 +0000 (23:08 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Thu, 21 Aug 2003 23:08:10 +0000 (23:08 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@23084 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/generic/listctrl.cpp

index 21f74335b6130438d8b9a643415cb746e772bef2..6674b681f658d6612c64bac74c5979bf9f4fae55 100644 (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);