Re: Frame size




On Dec 28, 2005, at 12:47 AM, Beast wrote:


I have frame inside frame

                                   e
+-Frame A ---------------------+   ^
|                              |   |
|  +-Frame B ------+           |   v
|  |               |           |   f
|  | [child label] |           |
|  |               |           |
|  +---------------+           |
+------------------------------+

a<->b              c<---------->d



1. How do I set the cellpadding (a-b and e-f)?

$frame_b->set_padding ($n_pixels);   # same amount on all sides

"Padding" is space around the outside of a widget, for all widgets *except* toplevel windows, for which padding is around the inside (since you can't add around the outside of a toplevel window).


2. How to make child frame width depends on the longest child label?

Im trying to set using $frameb->set_size_request(100, -1) but the width is always 100%

I infer from this that you *don't* want Frame B to fill up the whole inside of Frame A.

GtkFrame is a bin, so it is designed to give the child all of the space inside it. To get the child not to take up all that space, place the child inside another form of container and place that container in the Frame, instead.

For example:

   Frame A
      HBox
         Frame B  (packed with expand and fill set to FALSE)
            Label

This layout will expand the HBox fully in x and y, but since the HBox's child (Frame B) is *not* set to expand, it will take up only as much space as needed to show its children and will justify itself to the left of the HBox, leaving more space on the right than on the left. Because of the way HBoxes work, Frame B will expand fully in y. If you want to leave space on bottom as well as on top, use a VBox in addition to the HBox, or possibly a Table instead of Boxes.

Try playing around with these containers in Glade, and you can get a better feel for how they work.


--
me: Need any help?
elysse, hugging the toilet: No thanks, i can puke just fine by myself.





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