Re: how i click and open a file into textview?
- From: Olaf Frączyk <olaf cbk poznan pl>
- To: Aaron Yang <porsche1904 yahoo com>
- Cc: gtk-app-devel-list gnome org, glade-users lists ximian com, gtk-list gnome org
- Subject: Re: how i click and open a file into textview?
- Date: Mon, 25 Oct 2004 09:29:42 +0200
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]