Set the column for wxEVT_DATAVIEW_ITEM_ACTIVATED in wxGTK

The column is available in the GTK+ callback, so just pass it along to
avoid gratuitous inconsistency with the generic version.

Also update the sample to show the column value for these events.
This commit is contained in:
Vadim Zeitlin
2018-10-09 15:13:53 +02:00
parent 818d69f113
commit aafb87b40d
3 changed files with 6 additions and 3 deletions

View File

@@ -135,6 +135,7 @@ wxGTK:
- Fix not showing wxInfoBar with GTK+ 3 < 3.22.29. - Fix not showing wxInfoBar with GTK+ 3 < 3.22.29.
- Fix the build with glib < 2.32 (e.g. CentOS 6). - Fix the build with glib < 2.32 (e.g. CentOS 6).
- Fix field widths in wxStatusBar showing a size grip. - Fix field widths in wxStatusBar showing a size grip.
- Fill column value in wxEVT_DATAVIEW_ITEM_ACTIVATED events.
wxMSW: wxMSW:

View File

@@ -1214,7 +1214,8 @@ void MyFrame::OnValueChanged( wxDataViewEvent &event )
void MyFrame::OnActivated( wxDataViewEvent &event ) void MyFrame::OnActivated( wxDataViewEvent &event )
{ {
wxString title = m_music_model->GetTitle( event.GetItem() ); wxString title = m_music_model->GetTitle( event.GetItem() );
wxLogMessage( "wxEVT_DATAVIEW_ITEM_ACTIVATED, Item: %s", title ); wxLogMessage( "wxEVT_DATAVIEW_ITEM_ACTIVATED, Item: %s; Column: %d",
title, event.GetColumn() );
if (m_ctrl[0]->IsExpanded( event.GetItem() )) if (m_ctrl[0]->IsExpanded( event.GetItem() ))
{ {

View File

@@ -4461,10 +4461,11 @@ wxdataview_selection_changed_callback( GtkTreeSelection* WXUNUSED(selection), wx
static void static void
wxdataview_row_activated_callback( GtkTreeView* WXUNUSED(treeview), GtkTreePath *path, wxdataview_row_activated_callback( GtkTreeView* WXUNUSED(treeview), GtkTreePath *path,
GtkTreeViewColumn *WXUNUSED(column), wxDataViewCtrl *dv ) GtkTreeViewColumn *column, wxDataViewCtrl *dv )
{ {
wxDataViewItem item(dv->GTKPathToItem(path)); wxDataViewItem item(dv->GTKPathToItem(path));
wxDataViewEvent event(wxEVT_DATAVIEW_ITEM_ACTIVATED, dv, item); wxDataViewEvent
event(wxEVT_DATAVIEW_ITEM_ACTIVATED, dv, dv->GTKColumnToWX(column), item);
dv->HandleWindowEvent( event ); dv->HandleWindowEvent( event );
} }