]> git.saurik.com Git - wxWidgets.git/commitdiff
assert in OnSelected() fixed
authorVadim Zeitlin <vadim@wxwidgets.org>
Tue, 16 Nov 1999 16:59:10 +0000 (16:59 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Tue, 16 Nov 1999 16:59:10 +0000 (16:59 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@4594 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

samples/listctrl/listtest.cpp

index f8a8a18f3ac574bd90dd67d09d167a5e25386f39..0810b7d9913c085b166c045d2a75f700e1e22fd3 100644 (file)
@@ -491,18 +491,21 @@ void MyListCtrl::OnSelected(wxListEvent& event)
     if ( !text )
         return;
 
-    wxListItem info;
-    info.m_itemId = event.m_itemIndex;
-    info.m_col = 1;
-    info.m_mask = wxLIST_MASK_TEXT;
-    if ( GetItem(info) )
+    if ( GetWindowStyle() & wxLC_REPORT )
     {
-        *text << "Value of the 2nd field of the selected item: "
-              << info.m_text << '\n';
-    }
-    else
-    {
-        wxFAIL_MSG("wxListCtrl::GetItem() failed");
+        wxListItem info;
+        info.m_itemId = event.m_itemIndex;
+        info.m_col = 1;
+        info.m_mask = wxLIST_MASK_TEXT;
+        if ( GetItem(info) )
+        {
+            *text << "Value of the 2nd field of the selected item: "
+                  << info.m_text << '\n';
+        }
+        else
+        {
+            wxFAIL_MSG("wxListCtrl::GetItem() failed");
+        }
     }
 
     text->WriteText("OnSelected\n");