Re: Creating an aggregating GtkContainer



Tristan Van Berkom wrote:
On Wed, Nov 18, 2009 at 7:22 PM, Per Hermansson
<hermansson per bredband net> wrote:
Thanks, maybe I'm asking for the impossible :)
Say I use a scroll window for the different subcontainers to allow some
overflow.
Would it be possible to listen for signals on the containers and when the
widgets have gotten their size
allocated move them if the scrollbars became visible as a result of this.
The user will then probably experience some flicker as containers are
repainted and widgets moved.
Would this be reasonable/possible to implement?


First lets clarify, you are writing a container implementation, technically you
allocate space for the children, usually according to the size they requested.

So best not hook onto signals before properly implementing ->size_allocate()
and ->size_request() for your composite widget (from there you should be
able to manage all the main children - when reparenting a child this should
be all automatic, maybe theres a need for gtk_container_check_resize() in
some corner cases I couldnt say off hand).

Somehow I doubt that you want to move widgets around based on size
reallocation, I think that a well designed application layout should just stand
alone and widgets jumping around will confuse the user more than anything
else.

At any rate, there are nice things you can do like making sure an important
widget in the undetermined size window gets focus and is visible inside the
scrolled window - or remembering scroll positions of various tabs when they
get replaced or reloaded or such.
I agree that this will surely be confusing to anyone watching widgets move around. What I understand from the design makers is that having multiple containers that span different parts of the application is a replacement for having a single scrollable container since scrollbars
are not user friendly.

Anyway, I'm gonna test your advice and see if I can approximate the widget's size to avoid unnecessary flickering and widgets moving around. Other than that I don't think its possible
to do what I want with GTK+.

Thanks
Per



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