X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/74b31181b345aaaef0c967cc5707bef72ce0a405..b8aa1680f21faef698d39a2bce9c09e45a5bbf7a:/samples/listctrl/listtest.cpp?ds=sidebyside diff --git a/samples/listctrl/listtest.cpp b/samples/listctrl/listtest.cpp index f8a8a18f3a..0810b7d991 100644 --- a/samples/listctrl/listtest.cpp +++ b/samples/listctrl/listtest.cpp @@ -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");