void OnCollapsed( wxDataViewEvent &event );
void OnSelectionChanged( wxDataViewEvent &event );
+ void OnStartEditing( wxDataViewEvent &event );
void OnEditingStarted( wxDataViewEvent &event );
void OnEditingDone( wxDataViewEvent &event );
EVT_DATAVIEW_ITEM_COLLAPSED(ID_MUSIC_CTRL, MyFrame::OnCollapsed)
EVT_DATAVIEW_SELECTION_CHANGED(ID_MUSIC_CTRL, MyFrame::OnSelectionChanged)
+ EVT_DATAVIEW_ITEM_START_EDITING(ID_MUSIC_CTRL, MyFrame::OnStartEditing)
EVT_DATAVIEW_ITEM_EDITING_STARTED(ID_MUSIC_CTRL, MyFrame::OnEditingStarted)
EVT_DATAVIEW_ITEM_EDITING_DONE(ID_MUSIC_CTRL, MyFrame::OnEditingDone)
mainSizer->Add( m_notebook, 1, wxGROW );
mainSizer->Add( m_log, 0, wxGROW );
-
+
SetSizerAndFit(mainSizer);
}
}
+void MyFrame::OnStartEditing( wxDataViewEvent &event )
+{
+ wxString artist = m_music_model->GetArtist( event.GetItem() );
+ if (artist == "Ludwig van Beethoven")
+ {
+ event.Veto();
+
+ if (!m_log)
+ return;
+
+ wxLogMessage( "wxEVT_COMMAND_DATAVIEW_ITEM_START_EDITING vetoed, Item: %s", artist );
+ }
+}
+
void MyFrame::OnEditingStarted( wxDataViewEvent &event )
{
if (!m_log)
int pos = m_ctrl[0]->GetColumnPosition( event.GetDataViewColumn() );
wxLogMessage( "wxEVT_COMMAND_DATAVIEW_COLUMN_HEADER_CLICK, Column position: %d", pos );
+ wxLogMessage( "Column width: %d", event.GetDataViewColumn()->GetWidth() );
}
void MyFrame::OnHeaderRightClick( wxDataViewEvent &event )