Reid Thompson wrote:
> 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)|
> >> <http://ruby-gnome2.sourceforge.jp/hiki.cgi?Gtk%3A%3ABox#query_child_packing>
> >>     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
>
> <?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
> <!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">
>
> <glade-interface>
>
> <widget class="GtkWindow" id="window1">
>   <property name="visible">True</property>
>   <property name="title" translatable="yes">window1</property>
>   <property name="type">GTK_WINDOW_TOPLEVEL</property>
>   <property name="window_position">GTK_WIN_POS_NONE</property>
>   <property name="modal">False</property>
>   <property name="resizable">True</property>
>   <property name="destroy_with_parent">False</property>
>   <property name="decorated">True</property>
>   <property name="skip_taskbar_hint">False</property>
>   <property name="skip_pager_hint">False</property>
>   <property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
>   <property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
>   <property name="focus_on_map">True</property>
>   <property name="urgency_hint">False</property>
>
>   <child>
>     <widget class="GtkTable" id="table1">
>       <property name="visible">True</property>
>       <property name="n_rows">3</property>
>       <property name="n_columns">3</property>
>       <property name="homogeneous">False</property>
>       <property name="row_spacing">0</property>
>       <property name="column_spacing">0</property>
>
>       <child>
> 	<widget class="GtkHBox" id="hbox2">
> 	  <property name="width_request">103</property>
> 	  <property name="height_request">16</property>
> 	  <property name="visible">True</property>
> 	  <property name="homogeneous">False</property>
> 	  <property name="spacing">0</property>
>
> 	  <child>
> 	    <widget class="GtkStatusbar" id="statusbar2">
> 	      <property name="visible">True</property>
> 	      <property name="has_resize_grip">True</property>
> 	    </widget>
> 	    <packing>
> 	      <property name="padding">0</property>
> 	      <property name="expand">True</property>
> 	      <property name="fill">True</property>
> 	    </packing>
> 	  </child>
> 	</widget>
> 	<packing>
> 	  <property name="left_attach">1</property>
> 	  <property name="right_attach">2</property>
> 	  <property name="top_attach">2</property>
> 	  <property name="bottom_attach">3</property>
> 	  <property name="x_options">fill</property>
> 	  <property name="y_options"></property>
> 	</packing>
>       </child>
>
>       <child>
> 	<widget class="GtkHBox" id="hbox1">
> 	  <property name="width_request">103</property>
> 	  <property name="height_request">16</property>
> 	  <property name="visible">True</property>
> 	  <property name="homogeneous">False</property>
> 	  <property name="spacing">0</property>
>
> 	  <child>
> 	    <widget class="GtkStatusbar" id="statusbar1">
> 	      <property name="visible">True</property>
> 	      <property name="has_resize_grip">True</property>
> 	    </widget>
> 	    <packing>
> 	      <property name="padding">0</property>
> 	      <property name="expand">True</property>
> 	      <property name="fill">True</property>
> 	    </packing>
> 	  </child>
> 	</widget>
> 	<packing>
> 	  <property name="left_attach">0</property>
> 	  <property name="right_attach">1</property>
> 	  <property name="top_attach">2</property>
> 	  <property name="bottom_attach">3</property>
> 	  <property name="x_options">fill</property>
> 	  <property name="y_options"></property>
> 	</packing>
>       </child>
>
>       <child>
> 	<widget class="GtkHBox" id="hbox3">
> 	  <property name="visible">True</property>
> 	  <property name="homogeneous">False</property>
> 	  <property name="spacing">0</property>
>
> 	  <child>
> 	    <widget class="GtkStatusbar" id="statusbar3">
> 	      <property name="visible">True</property>
> 	      <property name="has_resize_grip">True</property>
> 	    </widget>
> 	    <packing>
> 	      <property name="padding">0</property>
> 	      <property name="expand">True</property>
> 	      <property name="fill">True</property>
> 	    </packing>
> 	  </child>
> 	</widget>
> 	<packing>
> 	  <property name="left_attach">2</property>
> 	  <property name="right_attach">3</property>
> 	  <property name="top_attach">2</property>
> 	  <property name="bottom_attach">3</property>
> 	  <property name="y_options"></property>
> 	</packing>
>       </child>
>     </widget>
>   </child>
> </widget>
>
> </glade-interface>

I am sure this will work, but I would rather not use glade.    It seems
rather bloated to add an XML layer to what should easily be done in
straight Ruby.  I notice that in the glade code you use a
height_request property, which I have done in Ruby, but this only sets
up the initial height (and the minimal height) and does not seem to
effect enlarging the toplevel window.   Why would the code work in
glade and not in Ruby?