Re: scrollable vbox



On Tue, Oct 09, 2001 at 11:26:49PM +0200, alblas wrote:
The problem is that buttons are stredged in horizontal direction to fill
all available space.
If I don't add scrollbars at all buttons are as narrow as possible.

You might want to try something as this:
gtk_widget_set_usize (button, width, height);
or this:
gtk_widget_set_usize (button, width, 0);

Unfortunatley that doesn't really help.
With gtk_widget_set_usize you can determine the minimum size to which you
can resize. But the vbox with buttons still grows as I resize the window.

What I need actually is a scrollable vbox with buttons, and next to it a
text widget. Now, what happens is that the available width is equally
distributed between the vbox and the text widget.
If I use gtk_widget_set_usize for both vbox and text the distribution of
width between the 2 can be changed. So, with the right width for both
widgets I can get more or less what I want:

gtk_widget_set_usize(vbox_widget,0,0);                      /* minimum width
such that wuttons just fit */
gtk_widget_set_usize(text_widget->parent,100,0); /* text widget much wider
*/

Until I resize the window to a bigger width; then, both text and vbox are
resized.

So, the question still stands: How to realize a vertical scrollable vbox
with always minimum width?

Do you want this?

      GtkRequisition req;
      gtk_widget_size_request (vbox, &req);
      g_object_set (vbox, "width-request", req.width, NULL);

The size_request won't work until the widget is connected to the screen,
so you might need to run this code after the "map" signal.  On the other
hand, it might just work.  You can test and find out.

-- 
Victory to the Divine Mother!!
  http://sahajayoga.org




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