0

I tried this one and it generates a TextView window:

http://zetcode.com/tutorials/gtktutorial/gtktextview/

But I don't want it to be editable.

BTW, how can I show the scroll bar when the text overflows?

gpoo
  • 8,408
  • 3
  • 38
  • 53
Gtker
  • 2,237
  • 9
  • 29
  • 37

1 Answers1

1

Check http://library.gnome.org/devel/gtk/stable/GtkTextView.html:

There's a gtk_text_view_set_editable function.

You can add scrollbars to widgets by adding them to a GtkScrolledWindow. Eg:

GtkWidget* scrolled = gtk_scrolled_window_new(NULL, NULL);
gtk_container_add (GTK_CONTAINER (scrolled), view);

And then instead of calling pack_start with view, call it with scrolled.

For centering, a GtkScrolledWindow isn't a top-level window so its position depends on the parent container (a VBox in the example). There are parameters of pack_start for padding etc which might get what you want.

gpoo
  • 8,408
  • 3
  • 38
  • 53
fgb
  • 18,439
  • 2
  • 38
  • 52
  • I used `gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER);` for a normal window,but seems it's not working for scrolled window? – Gtker Apr 29 '10 at 16:37