textview scrolling fails



Hi,

my call to gtk_text_view_scroll_to_iter fails and I really can't
figure out why. Here's some actual code I use:

 if(gtk_text_iter_forward_search(&iter, text, 0, &mstart, &mend, NULL)){
     printf("match\n");
     gtk_text_buffer_apply_tag_by_name(tb,"found", &mstart, &mend);
     last_pos=gtk_text_buffer_create_mark (tb, "last_pos", &mend, FALSE);
     gtk_text_view_scroll_to_iter(GTK_TEXT_VIEW(article_view),&mend,
                                   0,TRUE,0,.5);
 }

This search does find what I'm searching: on the console the "match"
is printed, and also the tag is aplied to the textbuffer at the found
section. But no scrolling occurs. Also using marks instead of iters
fails, ie,

gtk_text_view_scroll_mark_onscreen(GTK_TEXT_VIEW(article_view),last_pos);

doesn't scroll anyting.

I also made a button with the following callback, just to test wether
I can scroll to the end of the text:

static void scroll_cb(GtkWidget*w,GtkTextBuffer*tb)
{
 GtkTextIter start,end;

 printf("scroll cb");
 gtk_text_buffer_get_bounds(tb,&start,&end);
 gtk_text_view_scroll_to_iter(GTK_TEXT_VIEW(article_view),&end,
                               0,TRUE,0.0,0.0);

}

"scroll cb" is printed when clicked, but no scrolling occurs. I've
tried with different gtk versions, same problem.

Any ideas?

cheers.



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