wxTreeViewItem tvItem(item, TVIF_TEXT);
tvItem.pszText = (wxChar *)text.c_str(); // conversion is ok
DoSetItem(&tvItem);
+
+ // when setting the text of the item being edited, the text control should
+ // be updated to reflect the new text as well, otherwise calling
+ // SetItemText() in the OnBeginLabelEdit() handler doesn't have any effect
+ //
+ // don't use GetEditControl() here because m_textCtrl is not set yet
+ HWND hwndEdit = TreeView_GetEditControl(GetHwnd());
+ if ( hwndEdit )
+ {
+ if ( item == GetSelection() )
+ {
+ ::SetWindowText(hwndEdit, text);
+ }
+ }
}
int wxTreeCtrl::DoGetItemImageFromData(const wxTreeItemId& item,
}
}
-wxTextCtrl* wxTreeCtrl::GetEditControl() const
+wxTextCtrl *wxTreeCtrl::GetEditControl() const
{
return m_textCtrl;
}
// an image depending on the expanded/collapsed state - bug in
// comctl32.dll or our code?
{
- NM_TREEVIEW* tv = (NM_TREEVIEW*)lParam;
- if ( tv->action == TVE_EXPAND )
- {
- wxTreeItemId id = (WXHTREEITEM)tv->itemNew.hItem;
+ NM_TREEVIEW* tv = (NM_TREEVIEW *)lParam;
+ wxTreeItemId id = (WXHTREEITEM)tv->itemNew.hItem;
- int image = GetItemImage(id, wxTreeItemIcon_Expanded);
- if ( image != -1 )
- {
- RefreshItem(id);
- }
+ int image = GetItemImage(id, wxTreeItemIcon_Expanded);
+ if ( image != -1 )
+ {
+ RefreshItem(id);
}
}
break;
case TVN_GETDISPINFO:
// NB: so far the user can't set the image himself anyhow, so do it
// anyway - but this may change later
-// if ( /* !processed && */ 1 )
+ //if ( /* !processed && */ 1 )
{
wxTreeItemId item = event.m_item;
TV_DISPINFO *info = (TV_DISPINFO *)lParam;