]> git.saurik.com Git - wxWidgets.git/commitdiff
Postpone EnsureVisible() to idle as this sometimes seems to be required, fixes #12480...
authorRobert Roebling <robert@roebling.de>
Fri, 17 Sep 2010 19:07:02 +0000 (19:07 +0000)
committerRobert Roebling <robert@roebling.de>
Fri, 17 Sep 2010 19:07:02 +0000 (19:07 +0000)
circumstances on GTK

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65562 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/gtk/dataview.h
src/gtk/dataview.cpp

index 79dd7ad7adf97548f306d1dd4557f877e6f80131..0ca210c132a5c14624822be3521ee6039c7f494b 100644 (file)
@@ -200,6 +200,7 @@ private:
     GtkWidget               *m_treeview;
     wxDataViewCtrlInternal  *m_internal;
     wxDataViewColumnList     m_cols;
+    wxDataViewItem           m_ensureVisibleDefered;
 
     virtual void AddChildGTK(wxWindowGTK* child);
     void GtkEnableSelectionEvents();
index 0ef9a32f229c8f75a152f622e84a7226d0b9e373..a2dbd6ac08fb9e1a24e85bfb8f9b9e548d3bc477 100644 (file)
@@ -4548,6 +4548,16 @@ void wxDataViewCtrl::OnInternalIdle()
         wxDataViewColumn *col = GetColumn( i );
         col->OnInternalIdle();
     }
+    
+    if (m_ensureVisibleDefered.IsOk())
+    {
+        ExpandAncestors(m_ensureVisibleDefered);
+        GtkTreeIter iter;
+        iter.user_data = (gpointer) m_ensureVisibleDefered.GetID();
+        wxGtkTreePath path(m_internal->get_path( &iter ));
+        gtk_tree_view_scroll_to_cell( GTK_TREE_VIEW(m_treeview), path, NULL, false, 0.0, 0.0 );
+        m_ensureVisibleDefered = wxDataViewItem(0);
+    }
 }
 
 bool wxDataViewCtrl::AssociateModel( wxDataViewModel *model )
@@ -4948,6 +4958,7 @@ void wxDataViewCtrl::UnselectAll()
 void wxDataViewCtrl::EnsureVisible(const wxDataViewItem& item,
                                    const wxDataViewColumn *WXUNUSED(column))
 {
+    m_ensureVisibleDefered = item;
     ExpandAncestors(item);
 
     GtkTreeIter iter;