diff --git a/samples/treectrl/treetest.cpp b/samples/treectrl/treetest.cpp index ee4342195d..f32bea9dd3 100644 --- a/samples/treectrl/treetest.cpp +++ b/samples/treectrl/treetest.cpp @@ -1601,7 +1601,7 @@ void MyTreeCtrl::OnItemMenu(wxTreeEvent& event) wxPoint screenpt = ClientToScreen(clientpt); wxLogMessage(wxT("OnItemMenu for item \"%s\" at screen coords (%i, %i)"), - item ? item->GetDesc() : wxS("unknown"), screenpt.x, screenpt.y); + item ? item->GetDesc() : wxString(wxS("unknown")), screenpt.x, screenpt.y); ShowMenu(itemId, clientpt); event.Skip(); @@ -1646,7 +1646,7 @@ void MyTreeCtrl::OnItemRClick(wxTreeEvent& event) MyTreeItemData *item = (MyTreeItemData *)GetItemData(itemId); - wxLogMessage(wxT("Item \"%s\" right clicked"), item ? item->GetDesc() : wxS("unknown")); + wxLogMessage(wxT("Item \"%s\" right clicked"), item ? item->GetDesc() : wxString(wxS("unknown"))); event.Skip(); } diff --git a/samples/treectrl/treetest.h b/samples/treectrl/treetest.h index c7a28c9ca3..971b745cc1 100644 --- a/samples/treectrl/treetest.h +++ b/samples/treectrl/treetest.h @@ -45,7 +45,7 @@ public: MyTreeItemData(const wxString& desc) : m_desc(desc) { } void ShowInfo(wxTreeCtrl *tree); - const wxChar *GetDesc() const { return m_desc.c_str(); } + wxString const& GetDesc() const { return m_desc; } private: wxString m_desc;