开发者

How can I disable editting for GtkTextView in C?

I tried this one and it generates a TextView window:

开发者_如何学JAVA

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?


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜