RE: Controlling resizing of boxes when a window is resized

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

 



Thanks - I thought that there would be something simple like that.

The reason that I'm using gtk_widget_set_size_request on the upper box is
that I display a scrolled window in there, and without the size request the
scrolled window is too small and does not expand out to fill the upper area.
I would like to remove that gtk_widget_set_size_request that if I could get
it to expand out.

The code that sets up the boxes and the scrolled window is basically doing
this:

    frameVBox = gtk_vbox_new(FALSE, 0);

    /* Upper box for main display: */
    upperHBox = gtk_hbox_new(FALSE, 10);
    gtk_box_pack_start(GTK_BOX(frameVBox), upperHBox, TRUE, TRUE, 0);

    /* Add scrolled window into upper box */
    scrWindow = gtk_scrolled_window_new(NULL, NULL);
    gtk_box_pack_start(GTK_BOX(upperHBox), scrWindow, TRUE, TRUE, 0);

    /* Lower box for buttons: */
    lowerHBox = gtk_hbox_new(FALSE, 0);
    gtk_box_pack_end(GTK_BOX(frameVBox), lowerHBox, FALSE, FALSE, padding);

    gtk_container_add(GTK_CONTAINER(mainWin), frameVBox);

But the scrWindow window does not expand out to fill the upper part of the
window as I thought that it would. Adding a frame to upperHBox so that I can
see it shows that scrWindow fills upperHBox, but upperHBox has not expanded
out to fill the upper area. Hence I added a gtk_widget_set_size_request() to
force it to the required size.

Any idea on why upperHBox would not be expanding out to the full size of the
upper window (i.e. all of the space above lowerHBox), and how to get it to
do that?

Thanks,
Ian

> -----Original Message-----
> From: Richard Boaz [mailto:riboaz@xxxxxxxxx]
> Sent: Tuesday, April 04, 2006 10:52 PM
> 
> hi,
> 
> you should pack the two widgets into a vertical box so:
> 
> gtk_box_pack_start (vbox, topWidget, TRUE, TRUE, 0);
> gtk_box_pack_start (vbox, bottomWidget, FALSE, FALSE, 0);
> 
> see the documentation for argument #3 to achieve the effect you
> want.  also, avoid using gtk_widget_set_size_request() if the user
> ultimately has the say-so in deciding window size, use
> gtk_window_resize() on the top level window at startup instead.
> 
> cheers,
> 
> richard
> 
> 
> On Apr 5, 2006, at 3:43 AM, Ian Puleston wrote:
> 
> > Hi,
> >
> > I have an app that has its main display divided vertically into two
> > - an
> > upper box displaying various things, and a lower box containing
> > buttons. I
> > use a gtk_widget_set_size_request to set the minimum size of the
> > upper box,
> > and let the lower button box choose its own size.
> >
> > The problem is if the user resizes the window, it is the height of
> > the lower
> > button box that gets resized while the upper box stays unchanged,
> > which is
> > exactly the opposite of what I want.
> >
> > So, is there some way to control which child boxes within a window get
> > resized when the window is resized?
> >
> > Ian
> >
> >
> >
> > _______________________________________________
> > 
> > gtk-list@xxxxxxxxx
> > http://mail.gnome.org/mailman/listinfo/gtk-list
> >
> >



_______________________________________________

gtk-list@xxxxxxxxx
http://mail.gnome.org/mailman/listinfo/gtk-list


[Index of Archives]     [Touch Screen Library]     [GIMP Users]     [Gnome]     [KDE]     [Yosemite News]     [Steve's Art]

  Powered by Linux