make it possible to change the text of the item being edited from OnBeginLabelEdit()
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@33296 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -1105,6 +1105,11 @@ void MyTreeCtrl::OnBeginLabelEdit(wxTreeEvent& event)
|
||||
|
||||
event.Veto();
|
||||
}
|
||||
else if ( itemId == GetRootItem() )
|
||||
{
|
||||
// test that it is possible to change the text of the item being edited
|
||||
SetItemText(itemId, _T("Editing root item"));
|
||||
}
|
||||
}
|
||||
|
||||
void MyTreeCtrl::OnEndLabelEdit(wxTreeEvent& event)
|
||||
|
@@ -2577,6 +2577,10 @@ bool wxTreeCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result)
|
||||
eventType = wxEVT_COMMAND_TREE_BEGIN_LABEL_EDIT;
|
||||
TV_DISPINFO *info = (TV_DISPINFO *)lParam;
|
||||
|
||||
// although the user event handler may still veto it, it is
|
||||
// important to set it now so that calls to SetItemText() from
|
||||
// the event handler would change the text controls contents
|
||||
m_idEdited =
|
||||
event.m_item = info->item.hItem;
|
||||
event.m_label = info->item.pszText;
|
||||
event.m_editCancelled = false;
|
||||
@@ -2942,6 +2946,7 @@ bool wxTreeCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result)
|
||||
case TVN_BEGINLABELEDIT:
|
||||
// return true to cancel label editing
|
||||
*result = !event.IsAllowed();
|
||||
|
||||
// set ES_WANTRETURN ( like we do in BeginLabelEdit )
|
||||
if ( event.IsAllowed() )
|
||||
{
|
||||
@@ -2968,6 +2973,10 @@ bool wxTreeCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result)
|
||||
| wxTE_PROCESS_ENTER);
|
||||
}
|
||||
}
|
||||
else // we had set m_idEdited before
|
||||
{
|
||||
m_idEdited.Unset();
|
||||
}
|
||||
break;
|
||||
|
||||
case TVN_ENDLABELEDIT:
|
||||
|
Reference in New Issue
Block a user