I did a little investigating today. This bug is fixed in the latest. I git bisected and found out that the commit that makes it work is 15be68054074bc, which was in 3.5.1. So I gtk 3.6 should work for you.
On Fri, Nov 23, 2012 at 10:53 AM, Andrew Potter <agpot...@gmail.com> wrote: > I've run into this before myself [1]. Seems to happen only when you add > the Textview to an already show()n parent, as you are doing by adding it > with a button click. > > I gave up and used a label. They work fine. > > [1] > https://mail.gnome.org/archives/gtk-devel-list/2012-September/msg00034.html > > > On Sun, Nov 18, 2012 at 12:28 PM, Johan Mattsson < > johan.mattsso...@gmail.com> wrote: > >> Hi >> I am working on a GTK application that creates a form with many text >> areas in it. It seems to work fine until I add my widgets to a >> scrolled pane. Like this: >> >> test.vala: >> >> using Gtk; >> >> class MainWindow : Gtk.Window { >> >> Box vbox = new Box (Orientation.VERTICAL, 5); >> >> public MainWindow () { >> set_default_size (700, 600); >> >> Button b = new Button (); >> b.clicked.connect (add_text_field); >> vbox.pack_start (b, false, false, 0); >> >> ScrolledWindow scrolled = new ScrolledWindow (null, null); >> scrolled.set_policy (PolicyType.AUTOMATIC, >> PolicyType.AUTOMATIC); >> scrolled.add_with_viewport (vbox); >> >> add (scrolled); >> show_all (); >> } >> >> void add_text_field () { >> TextView text_view1 = new TextView (); >> TextBuffer text_buffer = new TextBuffer (null); >> text_buffer.set_text ("""A long text ... A long text ... >> A long text >> ... A long text ... A long text ... A long text ... A long text ... A >> long text ... A long text ... A long text ... A long text ... A long >> text ... A long text ... A long text ... A long text ... A long text >> ... A long text ... A long text ... A long text ... A long text ... A >> long text ... A long text ... A long text ... A long text ... A long >> text ... A long text ... A long text ... A long text ... A long text >> ... A long text ... A long text ... A long text ... A long text ... A >> long text ... A long text ... A long text ... A long text ... A long >> text ... A long text """); >> >> text_view1.set_wrap_mode (WrapMode.WORD); >> text_view1.set_buffer (text_buffer); >> >> vbox.pack_start (new Label ("New text view"), false, >> false, 0); >> vbox.pack_start (text_view1, false, false, 0); >> show_all (); >> } >> } >> >> public static void main(string[] args) { >> MainWindow m; >> Gtk.init (ref args); >> m = new MainWindow (); >> Gtk.main (); >> } >> >> Compile with valac test.vala --pkg gtk+-3.0 >> >> The height of the TextView is twice the number of lines in the box >> when TextView is added to the box. GTK will resize TextView when it >> gets focus. >> Is there a way to force GTK to recalculate the size of TextView before >> it receives focus? >> /Johan >> _______________________________________________ >> gtk-app-devel-list mailing list >> gtk-app-devel-list@gnome.org >> https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list >> > > _______________________________________________ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list