Re: GtkWindow and GtkPaned and check-resize



>On Tue, 2003-05-27 at 18:33, Marcin Krzyzanowski wrote:
>> Hi,
>> 
>> I have a strange problem.
>> 
>> I have a window, inside I put GtkPaned, and conenct to window as
>> GTK_CONTAINER() to signal check-size, I suppose that it shoult be
>> invoked only when window resize, but is is also when I move divider up
>> or down, why ?
>
>check-resize is nothing you want to connect to ... it's very much
>an internal implementation detail.
>
>> or could anybody tell me how to get moment when window window resized
>> right ? I tried size-request, but there is the same situation. All I
>> want to do is change divider position after window resize.
>
>::configure-event is probably best ... note that you'll need to
>look the size in the event, since when ::configure-event is received
>the widgets in the layout have not yet been layed out at the new
>size.

heh, heh. i wrote about this last week (not sure if i got a reply, i
was gone). i don't know much about Paned has changed for gtk+2, but
in gtk+1, its horrible for this kind of thing. to do what you want, i
had to (a) write gtk_paned_get_position(), since gtk+1.2 didn't
provide it and (b) connect to the size_allocate event for the
paned. there, i would check that the allocation was larger than the
desired position, and if so, would set the position. then i would have
to flag that i had done this for that pane, because if you do it again
later, you get into an endless feedback loop of size_allocate() events
induced by the set_position() call. in the end, it all works
nicely. in gtk+1.2 at least, if you attempt to set the position when
the allocation is too small, the position is clamped to the current
allocation, and the wrong thing happens.

btw, i also added a nice feature for my Paned's (as app code based on
catching button events on the Paned handle) whereby clicking on the
handle with a given button shrinks one child of the Paned to zero
size. its very useful for my app.

--p



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