Re: Help with TextView (jump)



I got it, in case anyone needs... a method to scroll to line and select it:

void Compilador::ScrollToLine(int line)
{
    Glib::RefPtr<Gtk::TextBuffer> buf = textview1->get_buffer();           
    Gtk::TextIter dumb = buf->get_iter_at_line((line-1));
    textview1->scroll_to(dumb,FALSE);
    Gtk::TextIter end = dumb;
    end.forward_lines(1);
    buf->select_range(dumb,end);
}


Well, someone won't suffer to have this working ;)

[]'s

On 9/6/07, Daniel Tiziani <dtiziani gmail com> wrote:
I tried this code:

    Glib::RefPtr<Gtk::TextBuffer> buf = textview1->get_buffer();           

    Gtk::TextIter dumb;
    textview1->get_iter_at_location(dumb, 0,30);
    textview1->scroll_to(dumb,TRUE);

to scroll the TextView (which is inside a ScrollWindow) in order to focus the line numbered 30, but it didn't work.
Is there any other way to scroll to a specific line?

And if it's possible, I would like to scroll to the n_th line and get it selected.


Thanks a lot! I'm trying to do things myself and search for solutions, but now I got stuck.

--
Daniel Tiziani
dtiziani at gmail.com



--
Daniel Tiziani
dtiziani at gmail.com

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