View Full Version : How do I make my textview area scrollable if...

05-15-2012, 10:55 PM
How do I make my textview area scrollable if there is to much text for the textview widget to hold?

For example, let's say my textview widget can hold 9 lines. If a tenth line is added the widget then extends vertically and the buttons are out of reach.

What I would like to do is if this becomes the problem. I want the text are to become scrollable.

How would I go about this?


05-15-2012, 11:59 PM
I figured it out.

I detached the textview from the table.(Removed the highlighted in red)

view = gtk_text_view_new ();
//gtk_table_attach_defaults(GTK_TABLE(table), view, 1, 9, 2, 5);
buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(view));

And enabled the scrollable window with:

scrolledwindow = gtk_scrolled_window_new(NULL, NULL);
gtk_container_add(GTK_CONTAINER(scrolledwindow), view);
gtk_table_attach_defaults(GTK_TABLE(table), scrolledwindow, 1, 9, 2, 5);

Thanks all.