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




      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;


Hi Christian,

Tx for replying.

I got it to work by initializing the iterator from the buffer, not the view:
view.buffer.get_iter_at_line(). I do not know why it does not work the
other round too -- I hope to learn someday  : - )

It is all working nicely now. Vala and valadoc sites have excellent
documentation - which is a boon for newbies like me.

For the first time, I am beginning to enjoy putting up GUI's -- this used
to be such a pain earlier.

Regards
Manish Jain



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