[chronojump] On encoder caputure scrolls to last row



commit 9d6019e1aa271d80c61fbcaa8ccd9c08973683af
Author: Xavier de Blas <xaviblas gmail com>
Date:   Tue Mar 10 14:47:50 2015 +0100

    On encoder caputure scrolls to last row

 src/gui/encoderTreeviews.cs |    3 +++
 src/utilGtk.cs              |   17 +++++++++++++++++
 2 files changed, 20 insertions(+), 0 deletions(-)
---
diff --git a/src/gui/encoderTreeviews.cs b/src/gui/encoderTreeviews.cs
index 2ac80e1..3fdf208 100644
--- a/src/gui/encoderTreeviews.cs
+++ b/src/gui/encoderTreeviews.cs
@@ -181,6 +181,9 @@ public partial class ChronoJumpWindow
                                treeview_encoder_capture_curves.AppendColumn (aColumn);
                        i++;
                }
+
+               UtilGtk.TreeviewScrollToLastRow(treeview_encoder_capture_curves, encoderCaptureListStore, 
encoderCaptureCurves.Count);
+
                return curvesCount;
        }
        
diff --git a/src/utilGtk.cs b/src/utilGtk.cs
index 6fff74e..00c692b 100644
--- a/src/utilGtk.cs
+++ b/src/utilGtk.cs
@@ -255,6 +255,23 @@ public class UtilGtk
                tv.ScrollToCell (path, null, true, 0, 0);
        }
 
+       public static void TreeviewScrollToLastRow(Gtk.TreeView tv, Gtk.ListStore store, int nrows) {
+               TreeIter iter = new TreeIter();
+               bool iterOk = store.GetIterFirst(out iter);
+               if(! iterOk)
+                       return;
+
+               for(int i=0; i < (nrows -1); i++)
+                       iterOk = tv.Model.IterNext (ref iter);
+               
+               if(! iterOk)
+                       return;
+               
+               TreePath path = store.GetPath (iter);
+               LogB.Debug(path.ToString());
+               tv.ScrollToCell (path, tv.Columns[0], true, 0, 0);
+       }
+
 
        /*
         *


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]