Hbox alignment with pack_start

Hi, I tried to make an interface like this.

http://i.imgur.com/hwfq1n6.png

But my interface:

http://i.imgur.com/F6OQ1nX.png

I want to adjoin toolbar and gtk.entry line. How can I do this? And
source code:

win = Gtk::Window.new
swin = Gtk::ScrolledWindow.new
swin_vpaned = Gtk::Paned.new(:horizontal)
viewport = Gtk::Viewport.new(swin.hadjustment, swin.vadjustment)
@file_store = Gtk::ListStore.new(String, String, TrueClass,
Gdk::Pixbuf)
main_vbox = Gtk::Box.new(:vertical, 2)
toolbar_hbox = Gtk::Box.new(:horizontal, 0)
menus = create_menubar
create_toolbar()
toolbar_hbox.pack_start(@toolbar, :expand => false, :fill => true,
:padding =>0)
toolbar_hbox.pack_start(@file_path_entry, :expand => true, :fill =>
true, :padding => 0)

main_vbox.pack_start(menus, :expand => false, :fill => false,

:padding => 2)
main_vbox.pack_start(toolbar_hbox, :expand => true, :fill => true,
:padding => 2)
main_vbox.pack_start(swin_vpaned, :expand => true, :fill => true,
:padding => 1)
treeview_vbox = Gtk::Box.new(:vertical, 1)
# devices treeview
dev_treeview = create_devices_treeview
treeview_vbox.pack_start(dev_treeview, :expand => false, :fill =>
false, :padding => 2)
create_places_treeview

treeview_vbox.pack_start(@places_treeview)
swin_vpaned.pack1(treeview_vbox, :resize => true, :shrink => false)
swin_vpaned.pack2(swin, :resize => true, :shrink => false)

win = Gtk::Window.new
swin = Gtk::ScrolledWindow.new
swin_vpaned = Gtk::Paned.new(:horizontal)
viewport = Gtk::Viewport.new(swin.hadjustment, swin.vadjustment)
@file_store = Gtk::ListStore.new(String, String, TrueClass,
Gdk::Pixbuf)
main_vbox = Gtk::Box.new(:vertical, 2)
toolbar_hbox = Gtk::Box.new(:horizontal, 0)
menus = create_menubar
create_toolbar()
toolbar_hbox.pack_start(@toolbar, :expand => false, :fill => true,
:padding =>0)
toolbar_hbox.pack_start(@file_path_entry, :expand => true, :fill =>
true, :padding => 0)

main_vbox.pack_start(menus, :expand => false, :fill => false,

:padding => 2)
main_vbox.pack_start(toolbar_hbox, :expand => true, :fill => true,
:padding => 2)
main_vbox.pack_start(swin_vpaned, :expand => true, :fill => true,
:padding => 1)
treeview_vbox = Gtk::Box.new(:vertical, 1)
# devices treeview
dev_treeview = create_devices_treeview
treeview_vbox.pack_start(dev_treeview, :expand => false, :fill =>
false, :padding => 2)
create_places_treeview

treeview_vbox.pack_start(@places_treeview)
swin_vpaned.pack1(treeview_vbox, :resize => true, :shrink => false)
swin_vpaned.pack2(swin, :resize => true, :shrink => false)

def create_toolbar
@toolbar = Gtk::Toolbar.new
@toolbar.set_size_request(30,30)

tool buttons

@back_toolbut = Gtk::ToolButton.new(:stock_id => Gtk::Stock::GO_BACK)
@next_toolbut = Gtk::ToolButton.new(:stock_id =>
Gtk::Stock::GO_FORWARD)
home_toolbut = Gtk::ToolButton.new(:stock_id => Gtk::Stock::HOME)
up_toolbut = Gtk::ToolButton.new(:stock_id => Gtk::Stock::GO_UP)

@back_toolbut.sensitive = false
@next_toolbut.sensitive = false
@back_toolbut.signal_connect(“clicked”){fill_store(“back”)}
@next_toolbut.signal_connect(“clicked”){fill_store(“next”)}
@toolbar.insert(@back_toolbut, 0)
@toolbar.insert(@next_toolbut, 1)
@toolbar.insert(up_toolbut, 2)
@toolbar.insert(home_toolbut, 3)

@toolbar.set_size_request(5, 5)

end

Thanks.

I tried your suggestion but still it doesn’t fix.
http://i.imgur.com/hwfq1n6.png

Ebru A. wrote in post #1134048:

I want to adjoin toolbar and gtk.entry line. How can I do this? And
source code:

create_toolbar()
toolbar_hbox.pack_start(@toolbar, :expand => false, :fill => true,
toolbar_hbox.pack_start(@file_path_entry, :expand => true, :fill => true,
main_vbox.pack_start(menus, :expand => false, :fill => false,
main_vbox.pack_start(toolbar_hbox, :expand => true, :fill => true
main_vbox.pack_start(swin_vpaned, :expand => true, :fill => true,

Perhaps you should expand false on packing tollbar_hbox :
main_vbox.pack_start(toolbar_hbox, :expand => false, :fill => true

Ebru A. wrote in post #1134151:

this intruction can trouble your toolbar :
@toolbar.set_size_request(30,30)

see example at :
http://ruby-gnome2.sourceforge.jp/hiki.cgi?tut-gtk2-mnstbs-tb

Ebru A. wrote in post #1134151:

I tried your suggestion but still it doesn’t fix.
http://i.imgur.com/hwfq1n6.png

So sorry, I’ve sent wrong screenshot, actually it is:

http://i.imgur.com/7bFUvfN.png

Regis d’Aubarede wrote in post #1134162:

with gtk3, this must be done :

main_vbox.homogeneous=false
and
toolbar_hbox…homogeneous=false

I set homogeneous=false but again it doesn’t fix. I don’t get any error.
Source code:

win = Gtk::Window.new
swin = Gtk::ScrolledWindow.new
swin_vpaned = Gtk::Paned.new(:horizontal)
viewport = Gtk::Viewport.new(swin.hadjustment, swin.vadjustment)
@file_store = Gtk::ListStore.new(String, String, TrueClass,
Gdk::Pixbuf)
main_vbox = Gtk::Box.new(:vertical, 2)
toolbar_hbox = Gtk::Box.new(:horizontal, 0)
menus = create_menubar
create_toolbar()
toolbar_hbox.pack_start(@toolbar, :expand => false, :fill => true,
:padding =>0)
toolbar_hbox.pack_start(@file_path_entry, :expand => true, :fill =>
true, :padding => 0)

main_vbox.pack_start(menus, :expand => false, :fill => false,

:padding => 2)
main_vbox.pack_start(toolbar_hbox, :expand => false, :fill => true,
:padding => 2)
main_vbox.pack_start(swin_vpaned, :expand => true, :fill => true,
:padding => 1)
treeview_vbox = Gtk::Box.new(:vertical, 1)
create_devices_treeview()
treeview_vbox.pack_start(@devices_treeview, :expand => false, :fill
=> false, :padding => 2)
create_places_treeview

main_vbox.homogeneous=false
toolbar_hbox.homogeneous=false
treeview_vbox.pack_start(@places_treeview)
swin_vpaned.pack1(treeview_vbox, :resize => true, :shrink => false)
swin_vpaned.pack2(swin, :resize => true, :shrink => false)

And screenshot:
http://i.imgur.com/0Zy1heT.png

with gtk3, this must be done :

main_vbox.homogeneous=false
and
toolbar_hbox…homogeneous=false

for me, it is better : hbox (toolbar+entry) take only necessary vertical
space.
Toolbar display only an arrow, I do not know why…
What append if the entry is not packed ?

Regis d’Aubarede wrote in post #1134172:

for me, it is better : hbox (toolbar+entry) take only necessary vertical
space.
Toolbar display only an arrow, I do not know why…
What append if the entry is not packed ?

When I remove Gtk.entry it seems like this:
http://i.imgur.com/SK0AecT.png

Probably cause of hbox I think.

But I couldn’t find out how can I ensure interface that i want, I think
I should use vbox, hbox. But it wasn’t.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs