Re: Intended behaviour of gtk_box_pack_{start,end}?




Ted Lemon <mellon@hoffman.vix.com> writes:

> Looking at the documentation, I get the impression that
> gtk_box_pack_start is supposed to add the widget at the topmost or
> leftmost part of the box, and gtk_box_pack_end is supposed to add the
> widget at the bottommost or rightmost part of the box.
> 
> What appears to happen right now is that gtk_box_pack_start puts the
> new widget at the end of the list of widgets but puts a flag on it
> saying that it belongs in the list of starting widgets.
> gtk_box_pack_end does the same thing, but flags the widgets to be put
> at the end.   

The difference between pack_start and pack_end is covered in
the tutorial. In essence, the difference is important when 
the widget is allocated more space than it needs:

+--------------------------------------------+
|  |     |                      |  |    |    |
+--------------------------------------------+

 pack_start    empty space        pack_end

> Then, when the time comes to allocate the widgets, all
> the widgets that were added using gtk_box_pack_start are displayed,
> sorted in order of insertion, and then all the widgets that were added
> using gtk_box_pack_end are displayed, sorted in order of insertion.
> So there's no primitive that will reliably insert a new widget at the
> beginning of the list.
> 
> There's also no primitive to insert a widget in the middle of the list
> - widgets can be inserted and _then_ sorted (or so I assume - I
> haven't tried it) but can't be given a specific initial position.

Yes, inserting at the end and then using:

void	   gtk_box_reorder_child       (GtkBox       *box,
					GtkWidget    *child,
					guint         pos);

is the way to do that.
 
Hope this helps,
                                        Owen



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