Re: automatically resizing widgets properly



On Sun, 2003-06-22 at 08:16, Chris Phillips wrote:
> Hi people,
> 
> I'm in the middle of porting my gtk app to gtk2, and have been replacing 
> set_usize calls to set_size_request, but I'm left thinking that there has 
> to be a better way to do this...? the docs talk about the inherent 
> duffness of forcing a widget size (i'm using lots of small gtk_entry's and 
> want them between 20 and 50px wide as part of a table). Is there any way 
> to make them automatically use any available space? if i don't set the 
> size of the widget, they naturally come out at full default size, completely 
> distorting the main UI.
> 
> for example, I have a table like this:
> 
> +-------------+--------+
> | <--entry--> | toggle |
> +-------------+--------+
> | <-------entry------> |
> +----------------------+
> 
> the lower entry is full size, and the toggle will naturally shrink, but i 
> then want the top entry to use all the remaining space in that table row.

One thing that can be useful in some cases is to set the size request of
a widget to be a single pixel in one direction:

gtk_widget_set_size_request (entry, 1, -1);

(-1 means use the widget's value). This avoids arbitrary numbers.
gtk_entry_set_width_chars (entry, 0) is probably an even better match
for your case, since it will take the border of the entry into acount.

Regards,
						Owen






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