Re: window and children resizable



Greg Breland wrote:

On Thu, 2005-07-07 at 08:06, Luca Cappa wrote:
Hello all,

I found that if a create a window and I put inside this window a widget, the window could not resize itself to a size smaller than the one requested by its child. How to overcome this problem?

http://developer.gnome.org/doc/API/2.0/gtk/GtkScrolledWindow.html

Adding a scrolled window and then placing you widgets inside will allow
the window to be sized smaller than the child request size.  You don't
have to show the scroll bars if you don't want that, but it's probably a
good idea.  There might be a better way to do this, but I'd use the
scrolled window so when the user does resize the window they can still
scroll to the part they want displayed.

I tryed it, and if I do not display the scroll bar of the ScrolledWindow the minimum size of the container will be
exactly the size request of the parent. here below there is the code I used.

int main (int argc, char *argv[])
{
   Gtk::Main lKit (argc, argv);

   Gtk::Window lWindow;
   Gtk::Image lImage ("supine_partialvolume.png");
   Gtk::ScrolledWindow lSW;
   lWindow.add (lSW);
   lSW.add (lImage);
   lSW.set_policy (Gtk::POLICY_NEVER, Gtk::POLICY_NEVER);
   lWindow.show_all_children ();

   lKit.run (lWindow);
   return 0;
}


Luca

I would like to have a window with all widgets that changes the size accordingly to the main container window's size. Is this easy to do? I do not see any way of doing it with set_size_request,
nor by using requisition/allocation event handling.


Once the window size is above the min size requested by the children,
the widgets should size themselves according to how you packed them.




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]