Re: how i click and open a file into textview?



On Mon, 2004-10-25 at 07:40, Aaron Yang wrote:
hi,

  after i insert a textview widget inside a window,
does anyone know what i should do to display the
contents of any file inside the widget?
Open file, and copy its content into TextBuffer associated with this
TextView.

Something like that:

Window->TextView2=gtk_text_view_new ();
Window->TextBuffer2=gtk_text_view_get_buffer (GTK_TEXT_VIEW
(Window->TextView2));
gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(Window->TextView2),GTK_WRAP_WORD);
gtk_text_buffer_get_end_iter(Window->TextBuffer2,&TextIterEnd);
gtk_text_buffer_insert(Window->TextBuffer2,&TextIterEnd,string,strlen(string));
gtk_text_buffer_get_end_iter(Window->TextBuffer2,&TextIterEnd);
gtk_text_buffer_move_mark(Window->TextBuffer2,Window->TextBuffer2Mark,&TextIterEnd);
gtk_text_view_scroll_to_mark(GTK_TEXT_VIEW(Window->TextView2),Window->TextBuffer2Mark,0.0,FALSE,0.0,0.0);


Regards,

Olaf




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