Skip to content

Commit cdead94

Browse files
committed
Make wxMetroDataViewTreeCtrl not editable - SAM issue #1552
1 parent f08d476 commit cdead94

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

include/wex/metro.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -609,6 +609,12 @@ class wxMetroDataViewTreeCtrl : public wxDataViewTreeCtrl
609609
const wxSize& size = wxDefaultSize,
610610
long style = wxDV_NO_HEADER,
611611
const wxValidator& validator = wxDefaultValidator);
612+
613+
void OnItemStartEditing(wxDataViewEvent& event)
614+
{
615+
// prevent editing
616+
event.Veto();
617+
}
612618
/*
613619
wxMetroDataViewTreeStore* GetStore()
614620
{

src/metro.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2122,9 +2122,11 @@ wxMetroDataViewTreeStoreContainerNode* wxMetroDataViewTreeStore::FindContainerNo
21222122
wxIMPLEMENT_DYNAMIC_CLASS(wxMetroDataViewTreeCtrl, wxDataViewTreeCtrl);
21232123

21242124
wxBEGIN_EVENT_TABLE(wxMetroDataViewTreeCtrl, wxDataViewTreeCtrl)
2125-
EVT_DATAVIEW_ITEM_EXPANDED(-1, wxMetroDataViewTreeCtrl::OnExpanded)
2126-
EVT_DATAVIEW_ITEM_COLLAPSED(-1, wxMetroDataViewTreeCtrl::OnCollapsed)
2125+
EVT_DATAVIEW_ITEM_EXPANDED(wxID_ANY, wxMetroDataViewTreeCtrl::OnExpanded)
2126+
EVT_DATAVIEW_ITEM_COLLAPSED(wxID_ANY, wxMetroDataViewTreeCtrl::OnCollapsed)
21272127
EVT_SIZE(wxMetroDataViewTreeCtrl::OnSize)
2128+
EVT_DATAVIEW_ITEM_START_EDITING(wxID_ANY, wxMetroDataViewTreeCtrl::OnItemStartEditing)
2129+
21282130
wxEND_EVENT_TABLE()
21292131

21302132
bool wxMetroDataViewTreeCtrl::Create(wxWindow* parent, wxWindowID id,

0 commit comments

Comments
 (0)