GTK+ Forums

Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
It is currently Wed Jul 30, 2014 9:15 pm

All times are UTC




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Adjust the size of component - scale within a window
PostPosted: Tue Mar 18, 2014 12:02 pm 
Offline

Joined: Sat Mar 15, 2014 3:16 am
Posts: 2
Hello guys, I am a newer to GTK+. I am using glade to draw a simple GUI for my music play. However, I am stuck at one problem which is the size scale in my window. I have tried different methods and search on the internet for a few days. But still, I can't stretch the scale and see the whole component in the layout. Would anyone can help me? Thanks a lot. Here is my xml file of gui.glade. Please take a look.


Code:
<?xml version="1.0" encoding="UTF-8"?>
<interface>
  <!-- interface-requires gtk+ 3.0 -->
  <object class="GtkAdjustment" id="adjustment1">
    <property name="lower">-100</property>
    <property name="upper">100</property>
    <property name="step_increment">1</property>
    <property name="page_increment">10</property>
    <property name="page_size">10</property>
  </object>
  <object class="GtkAdjustment" id="adjustment2">
    <property name="lower">-100</property>
    <property name="upper">100</property>
    <property name="step_increment">1</property>
    <property name="page_increment">10</property>
    <property name="page_size">10</property>
  </object>
  <object class="GtkAdjustment" id="adjustment3">
    <property name="lower">-100</property>
    <property name="upper">100</property>
    <property name="step_increment">1</property>
    <property name="page_increment">10</property>
    <property name="page_size">10</property>
  </object>
  <object class="GtkAdjustment" id="adjustment4">
    <property name="lower">-100</property>
    <property name="upper">100</property>
    <property name="step_increment">1</property>
    <property name="page_increment">10</property>
    <property name="page_size">10</property>
  </object>
  <object class="GtkAdjustment" id="adjustment5">
    <property name="lower">-100</property>
    <property name="upper">100</property>
    <property name="step_increment">1</property>
    <property name="page_increment">10</property>
    <property name="page_size">10</property>
  </object>
  <object class="GtkWindow" id="window1">
    <property name="visible">True</property>
    <property name="can_focus">False</property>
    <property name="can_default">True</property>
    <property name="gravity">center</property>
    <property name="has_resize_grip">False</property>
    <child>
      <object class="GtkBox" id="box1">
        <property name="visible">True</property>
        <property name="app_paintable">True</property>
        <property name="can_focus">False</property>
        <property name="orientation">vertical</property>
        <property name="spacing">1</property>
        <child>
          <object class="GtkGrid" id="grid2">
            <property name="visible">True</property>
            <property name="can_focus">False</property>
            <property name="column_spacing">14</property>
            <child>
              <object class="GtkFileChooserButton" id="Open">
                <property name="visible">True</property>
                <property name="can_focus">False</property>
                <property name="orientation">vertical</property>
              </object>
              <packing>
                <property name="left_attach">1</property>
                <property name="top_attach">0</property>
                <property name="width">1</property>
                <property name="height">1</property>
              </packing>
            </child>
            <child>
              <object class="GtkEntry" id="input_entry">
                <property name="visible">True</property>
                <property name="can_focus">True</property>
                <property name="editable">False</property>
                <property name="invisible_char">●</property>
                <property name="text" translatable="yes">Input Directory</property>
              </object>
              <packing>
                <property name="left_attach">0</property>
                <property name="top_attach">0</property>
                <property name="width">1</property>
                <property name="height">1</property>
              </packing>
            </child>
            <child>
              <object class="GtkEntry" id="output_entry">
                <property name="visible">True</property>
                <property name="can_focus">True</property>
                <property name="invisible_char">●</property>
                <property name="text" translatable="yes">Output Directory</property>
              </object>
              <packing>
                <property name="left_attach">2</property>
                <property name="top_attach">0</property>
                <property name="width">1</property>
                <property name="height">1</property>
              </packing>
            </child>
          </object>
          <packing>
            <property name="expand">False</property>
            <property name="fill">True</property>
            <property name="position">0</property>
          </packing>
        </child>
        <child>
          <object class="GtkGrid" id="grid1">
            <property name="visible">True</property>
            <property name="can_focus">False</property>
            <child>
              <object class="GtkButton" id="start">
                <property name="label" translatable="yes">start</property>
                <property name="visible">True</property>
                <property name="can_focus">True</property>
                <property name="receives_default">True</property>
              </object>
              <packing>
                <property name="left_attach">0</property>
                <property name="top_attach">0</property>
                <property name="width">1</property>
                <property name="height">1</property>
              </packing>
            </child>
            <child>
              <object class="GtkButton" id="reset">
                <property name="label" translatable="yes">rest</property>
                <property name="visible">True</property>
                <property name="can_focus">True</property>
                <property name="receives_default">True</property>
              </object>
              <packing>
                <property name="left_attach">1</property>
                <property name="top_attach">0</property>
                <property name="width">1</property>
                <property name="height">1</property>
              </packing>
            </child>
            <child>
              <object class="GtkLabel" id="label2">
                <property name="visible">True</property>
                <property name="can_focus">False</property>
                <property name="label" translatable="yes"> Q value</property>
              </object>
              <packing>
                <property name="left_attach">2</property>
                <property name="top_attach">0</property>
                <property name="width">1</property>
                <property name="height">1</property>
              </packing>
            </child>
            <child>
              <object class="GtkEntry" id="q_entry">
                <property name="visible">True</property>
                <property name="can_focus">True</property>
                <property name="invisible_char">●</property>
              </object>
              <packing>
                <property name="left_attach">3</property>
                <property name="top_attach">0</property>
                <property name="width">1</property>
                <property name="height">1</property>
              </packing>
            </child>
          </object>
          <packing>
            <property name="expand">False</property>
            <property name="fill">True</property>
            <property name="position">1</property>
          </packing>
        </child>
        <child>
          <object class="GtkGrid" id="grid4">
            <property name="visible">True</property>
            <property name="can_focus">False</property>
            <property name="column_homogeneous">True</property>
            <child>
              <object class="GtkLabel" id="label1">
                <property name="visible">True</property>
                <property name="can_focus">False</property>
                <property name="label" translatable="yes">55Hz</property>
              </object>
              <packing>
                <property name="left_attach">0</property>
                <property name="top_attach">0</property>
                <property name="width">1</property>
                <property name="height">1</property>
              </packing>
            </child>
            <child>
              <object class="GtkLabel" id="label4">
                <property name="visible">True</property>
                <property name="can_focus">False</property>
                <property name="label" translatable="yes">110Hz</property>
              </object>
              <packing>
                <property name="left_attach">1</property>
                <property name="top_attach">0</property>
                <property name="width">1</property>
                <property name="height">1</property>
              </packing>
            </child>
            <child>
              <object class="GtkLabel" id="label5">
                <property name="visible">True</property>
                <property name="can_focus">False</property>
                <property name="label" translatable="yes">220Hz</property>
              </object>
              <packing>
                <property name="left_attach">2</property>
                <property name="top_attach">0</property>
                <property name="width">1</property>
                <property name="height">1</property>
              </packing>
            </child>
            <child>
              <object class="GtkLabel" id="label6">
                <property name="visible">True</property>
                <property name="can_focus">False</property>
                <property name="label" translatable="yes">440Hz</property>
              </object>
              <packing>
                <property name="left_attach">3</property>
                <property name="top_attach">0</property>
                <property name="width">1</property>
                <property name="height">1</property>
              </packing>
            </child>
            <child>
              <object class="GtkLabel" id="label7">
                <property name="visible">True</property>
                <property name="can_focus">False</property>
                <property name="label" translatable="yes">880Hz</property>
              </object>
              <packing>
                <property name="left_attach">4</property>
                <property name="top_attach">0</property>
                <property name="width">1</property>
                <property name="height">1</property>
              </packing>
            </child>
          </object>
          <packing>
            <property name="expand">False</property>
            <property name="fill">True</property>
            <property name="position">2</property>
          </packing>
        </child>
        <child>
          <object class="GtkBox" id="box2">
            <property name="visible">True</property>
            <property name="can_focus">False</property>
            <property name="margin_bottom">276</property>
            <property name="homogeneous">True</property>
            <child>
              <object class="GtkScale" id="s1">
                <property name="visible">True</property>
                <property name="can_focus">True</property>
                <property name="orientation">vertical</property>
                <property name="adjustment">adjustment1</property>
                <property name="inverted">True</property>
                <property name="round_digits">1</property>
                <property name="value_pos">bottom</property>
              </object>
              <packing>
                <property name="expand">False</property>
                <property name="fill">True</property>
                <property name="position">0</property>
              </packing>
            </child>
            <child>
              <object class="GtkScale" id="s2">
                <property name="visible">True</property>
                <property name="can_focus">True</property>
                <property name="orientation">vertical</property>
                <property name="adjustment">adjustment2</property>
                <property name="inverted">True</property>
                <property name="round_digits">1</property>
                <property name="value_pos">bottom</property>
              </object>
              <packing>
                <property name="expand">False</property>
                <property name="fill">True</property>
                <property name="position">1</property>
              </packing>
            </child>
            <child>
              <object class="GtkScale" id="s3">
                <property name="visible">True</property>
                <property name="can_focus">True</property>
                <property name="orientation">vertical</property>
                <property name="adjustment">adjustment3</property>
                <property name="inverted">True</property>
                <property name="round_digits">1</property>
                <property name="value_pos">bottom</property>
              </object>
              <packing>
                <property name="expand">False</property>
                <property name="fill">True</property>
                <property name="position">2</property>
              </packing>
            </child>
            <child>
              <object class="GtkScale" id="s4">
                <property name="visible">True</property>
                <property name="can_focus">True</property>
                <property name="orientation">vertical</property>
                <property name="adjustment">adjustment4</property>
                <property name="inverted">True</property>
                <property name="round_digits">1</property>
                <property name="value_pos">bottom</property>
              </object>
              <packing>
                <property name="expand">False</property>
                <property name="fill">True</property>
                <property name="position">3</property>
              </packing>
            </child>
            <child>
              <object class="GtkScale" id="s5">
                <property name="visible">True</property>
                <property name="can_focus">True</property>
                <property name="orientation">vertical</property>
                <property name="adjustment">adjustment5</property>
                <property name="inverted">True</property>
                <property name="round_digits">1</property>
                <property name="value_pos">bottom</property>
              </object>
              <packing>
                <property name="expand">False</property>
                <property name="fill">True</property>
                <property name="position">4</property>
              </packing>
            </child>
          </object>
          <packing>
            <property name="expand">True</property>
            <property name="fill">True</property>
            <property name="padding">5</property>
            <property name="position">3</property>
          </packing>
        </child>
      </object>
    </child>
  </object>
</interface>


Attachments:
未命名.png
未命名.png [ 8.06 KiB | Viewed 103 times ]


Last edited by zerohour on Tue Mar 18, 2014 6:02 pm, edited 1 time in total.
No code tags
Top
 Profile  
 
 Post subject: Re: Adjust the size of component - scale within a window
PostPosted: Thu Mar 20, 2014 6:59 am 
Offline
Never Seen the Sunlight

Joined: Mon Apr 28, 2008 5:52 am
Posts: 734
Location: UK
Hello,

Attached is a much modified version of your Glade file.

The first note is that it is easier to use GtkGrid rather than GtkBox and that you are using far too many containers within containers.

By simplifying the containers I was then able to set the vertical expand on the GtkScale widget which should give the expected result.


Attachments:
test1.glade.tar.bz2 [1.15 KiB]
Downloaded 6 times

_________________
E.
Top
 Profile  
 
 Post subject: Re: Adjust the size of component - scale within a window
PostPosted: Fri Mar 21, 2014 9:35 am 
Offline

Joined: Sat Mar 15, 2014 3:16 am
Posts: 2
Woo! Thank you very much>.< But still I don't get what's wrong with my previous work. Strange


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group