[Glade-users] Im having problems putting text in a textwidget

Damon Chaplin damon@ximian.com
Wed, 31 Jan 2001 13:34:02 +0000


Magnus-swe wrote:
> 
> Hi.
> 
> I need to put text in a textwidget from Main.c
> 
> I take the text from a file and just want to show the text in the
> textwidget
> when the program starts, i can set text from callbacks.c
> but it wont work from Main.

It should work OK in main.c. (There used to be a problem where you
couldn't set the text before the widget was realized but I think that
was fixed before GTK+ 1.2.0.)

e.g.

  GtkWidget *window, *text;
  char *s;

  window = create_window1 ();
  text = lookup_widget (window, "text1");
  s = "Hello World!";
  gtk_text_insert (GTK_TEXT (text), NULL, NULL, NULL, s, strlen (s));

This just worked OK for me.

Damon