Forum: wxRuby Problem with spacing

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
9e6d05909dc733af570faadce1392e67?d=identicon&s=25 Michael Satterwhite (msatterwhite)
on 2009-04-03 19:14
Attachment: screenshot.jpg (30 KB)
I'm having the devil's time trying to get things laid out correctly.
I've attached a screenshot so that you can get an idea of what I'm
seeing. I've got a very unattractive space under the two combo boxes,
and another one under the buttons. I don't understand how to reduce
this.

I know it's impossible to guess what idiocy I might have created.
Therefore, (even though I don't like doing this) the .xrc file for this
screen follows. I want to thank everyone willing to look at this and
help teach this beginner with wxRuby. Here it is:

<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<resource xmlns="http://www.wxwindows.org/wxxrc" version="2.3.0.1">
  <object class="wxFrame" name="mainframe" subclass="ContactFrameUI">
    <style>wxDEFAULT_FRAME_STYLE|wxTAB_TRAVERSAL</style>
    <size>574,336</size>
    <title>Contact Management</title>
    <object class="wxBoxSizer">
      <orient>wxVERTICAL</orient>
      <object class="sizeritem">
        <option>1</option>
        <flag></flag>
        <border>5</border>
        <object class="wxBoxSizer">
          <orient>wxHORIZONTAL</orient>
          <object class="sizeritem">
            <option>0</option>
            <flag>wxALL</flag>
            <border>5</border>
            <object class="wxStaticText" name="groupLabel">
              <label>Contact Group:</label>
            </object>
          </object>
          <object class="sizeritem">
            <option>0</option>
            <flag>wxALL</flag>
            <border>5</border>
            <object class="wxComboBox" name="groupCombo">
              <tooltip>Select Group</tooltip>
              <value></value>
              <content />
            </object>
          </object>
          <object class="spacer">
            <option>1</option>
            <flag>wxEXPAND</flag>
            <border>5</border>
            <size>40,0</size>
          </object>
          <object class="sizeritem">
            <option>0</option>
            <flag>wxALL</flag>
            <border>5</border>
            <object class="wxStaticText" name="contactLabel">
              <label>Contact:</label>
            </object>
          </object>
          <object class="sizeritem">
            <option>0</option>
            <flag>wxRIGHT</flag>
            <border>15</border>
            <object class="wxComboBox" name="contactCombo">
              <value></value>
              <content />
            </object>
          </object>
        </object>
      </object>
      <object class="sizeritem">
        <option>1</option>
        <flag>wxEXPAND</flag>
        <border>5</border>
        <object class="wxFlexGridSizer">
          <rows>6</rows>
          <cols>2</cols>
          <vgap>0</vgap>
          <hgap>0</hgap>
          <growablecols></growablecols>
          <growablerows></growablerows>
          <object class="sizeritem">
            <option>0</option>
            <flag>wxALL</flag>
            <border>5</border>
            <object class="wxStaticText" name="companylabel">
              <label>Company:</label>
            </object>
          </object>
          <object class="sizeritem">
            <option>0</option>
            <flag>wxALL</flag>
            <border>5</border>
            <object class="wxTextCtrl" name="companyText">
              <size>200,-1</size>
              <value></value>
              <maxlength>0</maxlength>
            </object>
          </object>
          <object class="sizeritem">
            <option>0</option>
            <flag>wxALL</flag>
            <border>5</border>
            <object class="wxStaticText" name="phoneLabel:">
              <label>Phone:</label>
            </object>
          </object>
          <object class="sizeritem">
            <option>0</option>
            <flag>wxALL</flag>
            <border>5</border>
            <object class="wxTextCtrl" name="phoneText">
              <size>125,-1</size>
              <value></value>
              <maxlength>0</maxlength>
            </object>
          </object>
          <object class="sizeritem">
            <option>0</option>
            <flag>wxALL</flag>
            <border>5</border>
            <object class="wxStaticText" name="contactLabel">
              <label>Contact Name:</label>
            </object>
          </object>
          <object class="sizeritem">
            <option>0</option>
            <flag>wxALL</flag>
            <border>5</border>
            <object class="wxTextCtrl" name="contactText">
              <size>200,-1</size>
              <value></value>
              <maxlength>0</maxlength>
            </object>
          </object>
          <object class="sizeritem">
            <option>0</option>
            <flag>wxALL</flag>
            <border>5</border>
            <object class="wxStaticText" name="addressLabel">
              <label>Address:</label>
            </object>
          </object>
          <object class="sizeritem">
            <option>0</option>
            <flag>wxALL</flag>
            <border>5</border>
            <object class="wxTextCtrl" name="addressText">
              <size>200,100</size>
              <value></value>
              <maxlength>0</maxlength>
            </object>
          </object>
        </object>
      </object>
      <object class="sizeritem">
        <option>1</option>
        <flag>wxEXPAND</flag>
        <border>5</border>
        <object class="wxBoxSizer">
          <orient>wxHORIZONTAL</orient>
          <object class="sizeritem">
            <option>0</option>
            <flag>wxALL</flag>
            <border>5</border>
            <object class="wxButton" name="addButton">
              <label>Add Contact</label>
              <default>0</default>
            </object>
          </object>
          <object class="sizeritem">
            <option>0</option>
            <flag>wxALL</flag>
            <border>5</border>
            <object class="wxButton" name="updateButton">
              <label>_Update Contact</label>
              <default>0</default>
            </object>
          </object>
          <object class="sizeritem">
            <option>0</option>
            <flag>wxALL</flag>
            <border>5</border>
            <object class="wxButton" name="deleteButton">
              <label>_Delete Contact</label>
              <default>0</default>
            </object>
          </object>
          <object class="sizeritem">
            <option>0</option>
            <flag>wxALL</flag>
            <border>5</border>
            <object class="wxButton" name="clearButton">
              <label>C_lear Form</label>
              <default>0</default>
            </object>
          </object>
          <object class="sizeritem">
            <option>0</option>
            <flag>wxALL</flag>
            <border>5</border>
            <object class="wxButton" name="quitButton">
              <label>E_xit</label>
              <default>0</default>
            </object>
          </object>
        </object>
      </object>
    </object>
    <object class="wxMenuBar" name="m_menubar1">
      <label>MyMenuBar</label>
      <object class="wxMenu" name="m_File">
        <label>_File</label>
      </object>
      <object class="wxMenu" name="m_data">
        <label>_Data</label>
        <object class="wxMenuItem" name="m_datagroup">
          <label>Contact Group</label>
          <help></help>
        </object>
      </object>
    </object>
  </object>
</resource>
3396e4a3df8a840faec520af8555a400?d=identicon&s=25 Mario Steele (Guest)
on 2009-04-05 11:23
(Received via mailing list)
Hello Michael,

I went directly to your screenshot, and realized what the problem was
without even looking at your message.  Then I went and read your
message.
;-)

Anyways, the problem, is that your xrc has the problem, of telling your
wxHORIZONTAL box, to have a proportion of 1, which is what you get ,
cause
it's taking up an even space between the three actual sizers you have in
your XRC Code.

The specific line in the XRC is here:

<snip>

>            <flag>wxALL</flag>
>            <border>5</border>
>            <object class="wxStaticText" name="groupLabel">
>              <label>Contact Group:</label>
>            </object>
>          </object>

</snip>

You need to change that <option>1</option> to <option>0</option>  Which
handles the Proportion of your Horizontal box sizer.  Once you do that,
you
should get the correct layout.

If your using wxFormBuilder, you can find this in the properties of the
wxHorizontal sizer, under the heading of sizeritem.

hth,

Mario
9e6d05909dc733af570faadce1392e67?d=identicon&s=25 Michael Satterwhite (msatterwhite)
on 2009-04-05 17:12
Mario Steele wrote:
> Hello Michael,
>
> I went directly to your screenshot, and realized what the problem was
> without even looking at your message.  Then I went and read your
> message.
> ;-)

Thank you *VERY* much.

I'm still trying to get the various options regarding spacers and sizers
into my head. I really appreciate you helping me here.

---Michael
This topic is locked and can not be replied to.