Re: Auto-adjusting image (SOLVED)



Pelle Nilsson <pellenilsson fastmail fm> writes:

$image->set_size_request(0, 0);

and that solved it. I didn't try it before because I thought the size
request would also shrink the image to zero size, but it didn't.

I think it would if it was the first thing you did :-).  If it's later
on then I expect the toplevel size has been determined.

size_request is meant to be how big a widget would like to be, if
possible.  The container can then honour that, or not, or make a best
effort.  If the image widget says it wants to be 100x100 you may be able
to go below that if you tell the toplevel

    $window->set (allow_shrink => 1);

Or better perhaps if the image says 0x0 for no desired size then you
might

    $window->set_default_size

for a sensible initial size.  As a bit of shameless self-promotion I
made a few lines to help derive an initial size in my Gtk2::Ex::Units
(the set_default_size_with_subsizes() bit).



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