From: Reid Thompson Date: 2006-10-21T11:18:43+09:00 Subject: Re: Sizing Widgets WoodHacker wrote: > Reid Thompson wrote: >> WoodHacker wrote: >>> Reid Thompson wrote: >>> >>>> On Fri, 2006-10-20 at 03:35 +0900, WoodHacker wrote: >>>> >>>>> I'm new to Ruby/Gtk and find it, so far, exactly what I want for a GUI. >>>>> However, I have one problem that I can't seem to figure out and that >>>>> has to do with setting sizes of widgets. For example, I want to >>>>> create a status bar with four display areas. I can use an HBox for >>>>> the container and use four status bars for the info. Works great. >>>>> I can set the first three to be small for position data and the fourth >>>>> one to be long for general messages. Done all the time. (there may >>>>> be a better way to do this, but it works) >>>>> >>>>> However, if the user resizes the main window, the statusbars stretch in >>>>> all directions, including height. I want only the last area to >>>>> stretch and it only in width. Setting height and width_requests seem >>>>> to only affect shrinking the window. >>>>> >>>>> I'm having the same problem with my menubar - it stretches in height >>>>> when the window is resized. There has to be an easy fix to this, but >>>>> so far it eludes me. >>>>> >>>>> Bill >>>>> >>>>> >>>>> >>>> http://ruby-gnome2.sourceforge.jp/hiki.cgi?Gtk%3A%3ABox >>>> >>>> see section on child props >>>> >>> In the statusbar code, I'm using pack_start as defined in the section >>> you quote. And I get the >>> status boxes to remain stable in the x direction. In other words, the >>> first three boxes stay in their fixed size and the fourth one enlarges. >>> The problem is with the y direction. All the boxes grow in the y >>> direction. This also happens with my menubar. And I believe the >>> menubar doesn't allow you to use pack - it wants append, which gives >>> you no control at all. >>> >>> >>> >> what are the values of: >> >> |query_child_packing(child)| >> >> Returns information about how child is packed into box. >> > > I should have said: > > I get false, false, 0, 1 (start) fror the first three and true, true, > 0, 1(start) for the last one. > >> * Returns: [expand, fill, padding, pack_type] > > A glade file that gives the effect that you want ( i believe --> resizing the main window does not affect the size of the status bars in cell 1 and 2 either way, the status bar in cell 3 will expand in direction X) A window with a 3x3 table. row 3's cells each contain an Hbox cell 1 and 2's Hbox's have explicitly set Height an Width each hbox contains a status bar properties of the hbox control the expansion of the cell see the packing settings for the boxes below True window1 GTK_WINDOW_TOPLEVEL GTK_WIN_POS_NONE False True False True False False GDK_WINDOW_TYPE_HINT_NORMAL GDK_GRAVITY_NORTH_WEST True False True 3 3 False 0 0 103 16 True False 0 True True 0 True True 1 2 2 3 fill 103 16 True False 0 True True 0 True True 0 1 2 3 fill True False 0 True True 0 True True 2 3 2 3