Fix wxListCtrl::EndEditLabel() which simply didn't work.

Also document it (even though it's wxMSW-only for now) and add a test for it
in the sample.

Closes #7663.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@64368 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2010-05-20 22:04:03 +00:00
parent 212e8ef365
commit 747eb0f686
3 changed files with 38 additions and 15 deletions

View File

@@ -840,16 +840,26 @@ void MyFrame::OnAdd(wxCommandEvent& WXUNUSED(event))
void MyFrame::OnEdit(wxCommandEvent& WXUNUSED(event))
{
long itemCur = m_listCtrl->GetNextItem(-1, wxLIST_NEXT_ALL,
wxLIST_STATE_FOCUSED);
if ( itemCur != -1 )
// demonstrate cancelling editing: this currently is wxMSW-only
#ifdef __WXMSW__
if ( m_listCtrl->GetEditControl() )
{
m_listCtrl->EditLabel(itemCur);
m_listCtrl->EndEditLabel(true);
}
else
else // start editing
#endif // __WXMSW__
{
m_logWindow->WriteText(wxT("No item to edit"));
long itemCur = m_listCtrl->GetNextItem(-1, wxLIST_NEXT_ALL,
wxLIST_STATE_FOCUSED);
if ( itemCur != -1 )
{
m_listCtrl->EditLabel(itemCur);
}
else
{
m_logWindow->WriteText(wxT("No item to edit"));
}
}
}