Re: [Vala] Need help to scroll a textview using a scale




On 01/24/2018 10:03 AM, Manish Jain wrote:
My last effort at the event handler is below (it is of no use, really):

      void scale_moved (Gtk.Range range)
      {
          int i;
          Gtk.TextIter iter = new Gtk. TextIter();
          view.get_iter_at_position(out iter, out i, 0, 0);
          iter.set_line(iter.get_line() + 10);
          view.scroll_to_iter(iter, 0, false, 0, 0);
      }


GtkTextView implements GtkScrollable, which means you can get a GtkAdjustment for the vertical range.

Something like:

  range.adjustment = text_view.vadjustment;

You can also just add the textview to a GtkScrolledWindow.

-- Christian


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