[Vala] Need help to scroll a textview using a scale
- From: Manish Jain <bourne identity hotmail com>
- To: "vala-list gnome org" <vala-list gnome org>
- Subject: [Vala] Need help to scroll a textview using a scale
- Date: Wed, 24 Jan 2018 18:03:05 +0000
Hi,
I am new to vala and am trying to pick up the fundamentals.
I was trying to create a a GTK application with 3 components:
Gtk.ScrolledWindow scrolled;
Gtk.TextView view;
Gtk.Scale v_scale;
The scrolled view widget is to display a text file read at run time.
I would like to the view's current contents to be controlled by the
v_scale: when v_scale slider is 0, the view shows the beginning of the
file, and when v_scale slider is close to 100, the view shows the last
few characters/lines in the file.
Despite a lot of effort to write an event handler, I still cannot get
the scale to tell the view to scroll.
Can somebody please tell me how to control the view's position with the
scale in Vala ?
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);
}
--
Thanks & Regards,
Manish Jain
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]