On 12/1/06, Jef Driesen <[EMAIL PROTECTED]> wrote: > I have created a toplevel window like this: > > <window> > <vbox> > <expander> > <treeview> > <table> > <label><entry> > <label><entry> > ... > > The glade file is available on my website [1]. > > The labels and entries in the table have a fixed height. Thus, resizing > the window should change the size of the treeview (if it's not hidden by > the expander of course). But it doesn' work the way I want it. > > The window starts with the expander collapsed. When I use the arrow to > expand it, the arrow changes its state, but the treeview remains > invisible. See screenshot [2]. Only when I enlarge the toplevel window, > I can make the treeview visible. It seems like the initial height of the > treeview is zero? If I replace the treeview with another widget like a > button, it is shown instantly (e.g. without enlarging the toplevel window).
This is probably because the treeview doesn't specify a minimum size / size request, whereas a button does. If you set a minimum size, it'll probably expand the window when you expand the expander. > Now, if I collapse again, the treeview disappears like it should, but > the space where it used to be remains empty. See screenshot [3]. And > that's not certainly not what I wanted. This empty space should be gone > and the toplevel window should shrink. How can I do that? I think this is a pretty common issue with GTK apps. I think the general solution is: avoid designing your UI so that the top-level window can change size based on user interaction. However, there are a couple of things you can do. One is to connect to the expander activation signal, and resize your window manually (note: I think if you set the height to some small value like 1 then GTK will try to make it as small as it can while still showing all widgets, but then the user will lose any resizing they did before they collapsed the window). Another option is to make your window non-resizeable, and then GTK+ will automatically shrink the size when you collapse the expander. Of course the disadavantage of this is that your window is ... non-resizeable. -- jonner _______________________________________________ gtkmm-list mailing list [email protected] http://mail.gnome.org/mailman/listinfo/gtkmm-list
