Re: gtk_widget_size_request v. reality



OK, Glade is interesting, and I've since used GtkAlignment in other parts of
my library, but I still haven't fixed my original problem.

I'm not sure if I fully understand your suggestion, but this is where I'm at
right now.

It appears that the 'size-request' signal only happens once, and is
not called when the user resizes the window.  I couldn't find a 'resize'
signal definition so I'm not sure what other signals I need to set up for
this to happen all the time.

Assuming callback signals are fixed, I interpreted your use "an alignment
and set the Left/Right Padding" as make a container widget (hbox in my
case), put the two child widgets into alignment containers, and finally add
the two alignment containers to the hbox widget.

When I add padding to an alignment widget in the 'size-request' callback,
this padding just 'covers up' the widget I'm trying to display instead of
making more room and pushing the 2nd widget to the side.

What is happening makes sense because the hbox has to give the alignment the
space to use, so at this point I'm just confused about how you thought what
you said would solve my problem.

I'll try to describe it again.

I'm trying to build a widget that displays two other widgets within a
rectangle.  I want these two widgets to have complimentary widths determined
by a parameter given to the parent widget.  This parameter determines where
one widget's width ends and the next begins and is read as a percentage of
the parent widget's width.  I'm trying to set an invisible pane/divider
that the user can't change.

If the parameter was 0.3, the 1st widget would take up 30% of the parent's
width while the 2nd would take up the remaining 70%.  No matter what the
user does to the window, this ratio should be constant.

Maybe I'm using an old Glade, but I couldn't get anything to behave like
widget described above.

~Thanks

On 12/13/06, Jim George <jimgeorge gmail com> wrote:

> How do I force a parent to tell the child how much space will be
available
> to the child at this time?  Is it even possible?  Do I really have to
call
> gtk_widget_set_size_request()/gtk_widget_size_request() on every parent
so
> that the children have something to work with?

Use an alignment and set the Left/Right Padding in a callback for
"size-request" of the parent.

> I'm new to GTK, but as far as I can tell, most GTK tutorials and
> documentation don't really cover packing widgets when homogeneous,
expand,
> and fill are not all set to TRUE (if only I could just let GTK do it all
for
> me...).
>
> Suggestions?

Open up glade, create a dummy project and play around with it. I got
around a bunch of GTK's crummy documentation by doing this. You can
also consider using glade and libglade in your app, instead of just as
an exploration tool.

-Jim
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list




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