Re: a sequence to edit a text view...
- From: Iago Rubio <iago iagorubio com>
- To: gtk-app-devel-list gnome org
- Subject: Re: a sequence to edit a text view...
- Date: Fri, 19 Aug 2005 10:58:05 +0200
On Thu, 2005-08-18 at 18:55 -0300, Joaquim Azevedo wrote:
I'm a begginer in GTK and I use glade to create a interface... but I
need to edit a text view. I set it editable but not happen... I think
is that a correct sequence...
A part of code:
char result[150];
int position;
GtkWidget *tb_result,
*top_level;
top_level = gtk_widget_get_toplevel( GTK_WIDGET( tb_result ) );
tb_result = lookup_widget( top_level, "tb_result" );
gtk_editable_set_editable( GTK_EDITABLE( ), TRUE );
position = gtk_editable_get_position( GTK_EDITABLE( tb_result ) );
gtk_editable_insert_text( GTK_EDITABLE( tb_result )
, result
, strlen( result )
, position );
A text view is not a GtkEditable.
Your code may work with a GtkEntry but not with a GtkTextView,
You may access to the underlying GtkTextBuffer to modify the text, the
GtkTextView is a container.
GtkTextBuffer *buffer;
GtkWidget *tb_result,
*top_level;
top_level = gtk_widget_get_toplevel( GTK_WIDGET( tb_result ) );
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (tb_result));
gtk_text_buffer_insert_at_cursor ( buffer,
result,
strlen(result));
--
Iago Rubio
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]