[Glade-users] why doesn't this work - gtk_entry_set_text



Alef T Veld wrote:

Hi

I have this code

GtkWidget *test;
GtkWidget *notebook;
GladeXML *xml;
const gchar *string[1];

test=glade_xml_get_widget(xml,"entry1");
string[0]=gtk_entry_get_text(GTK_ENTRY(test));

/* update notebook widget */
notebook=glade_xml_get_widget(xml,"textview1");
gtk_entry_set_text(GTK_ENTRY(notebook),string[0]);

But it doesn't seem to work.
What am i doing wrong?
 

Hello,
Looks like that you're trying to use GtkEntry method on GtkTextView 
widget, look at console you may see a couple of warnings. Try this:
gtk_text_buffer_set_text( gtk_text_view_get_buffer(textview1), 
string[0], -1 );

GtkTextView and GtkTextBuffer are complex widgets, you can read about 
them at:
http://developer.gnome.org/doc/API/gtk/GtkTextView.html
http://developer.gnome.org/doc/API/gtk/GtkTextBuffer.html

    Olexiy






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