Inserting Text in a Text Widget



Hi,

I am using a gtk_text Widget in my application. Now I realized, that it
is not possible to insert text in the widget with gtk_text_insert unless
I call gtk_widget_realize(my_text_widget). What is this realize thing?
Why do I need it?

This is the actual code I have used:

  text_area = gtk_text_new(NULL, NULL);
  text_hbox = gtk_hbox_new(FALSE, 0);
  gtk_box_pack_start(GTK_BOX(text_hbox), text_area, TRUE, TRUE, 0);
  gtk_widget_show(text_area);
  text_scrollbar = gtk_vscrollbar_new (GTK_TEXT(text_area)->vadj);
  gtk_box_pack_start(GTK_BOX(text_hbox), text_scrollbar, FALSE, FALSE, 0);
  gtk_widget_show (text_scrollbar);
  gtk_box_pack_start(GTK_BOX(main_box), text_hbox, TRUE, TRUE, 0);
  gtk_widget_show(text_hbox);
  
  gtk_widget_realize(text_area);
  gtk_text_insert(GTK_TEXT(text_area), NULL, NULL, NULL, "Hello World", -1);


-- 
Rolf Herzog | rolf@culthea.gun.de             | MUSH: Talandir@Imbris
Duisburg    | her@sti1.uni-duisburg.de        | ICQ#: 7434366
Germany     | "Ohne Reproduktion gaebe es keine Originale"





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