Problem with Table in a ScrolledWindow in a Notebook

Hi,

In the following script when I select ‘page 2’ in the notebook,
the hello button isn’t shown. If I switch tabs, then show ‘page 2’,
for a second time, the button is shown.

Am I doing something wrong?

Martin.

require ‘gtk2’

Gtk.init

win = Gtk::Window.new

notebook = Gtk::Notebook.new()

table = Gtk::Table.new(1,1)

scrolled_win = Gtk::ScrolledWindow.new
scrolled_win.add_with_viewport( table )

notebook.append_page( Gtk::Label.new(“empty”), Gtk::Label.new(“page 1”))
notebook.append_page( scrolled_win, Gtk::Label.new(“page 2”))

win.add( notebook )

win.show_all

notebook.signal_connect(“switch-page”){|w,page,page_num|
if( page_num==1)
table.resize(1,1)
button = Gtk::Button.new(“hello”)
table.attach_defaults( button, 0,1, 0,1 )
button.show
end
}

Gtk.main


Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net’s Techsay panel and you’ll get the chance to share
your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

On Tue, Mar 20, 2007 at 03:27:57PM +0000, Martin P. wrote:

Hi,

In the following script when I select ‘page 2’ in the notebook,
the hello button isn’t shown. If I switch tabs, then show ‘page 2’,
for a second time, the button is shown.

Am I doing something wrong?

Switch to using signal_connect_after. Otherwise, you end up doing
something before Gtk::Notebook does, which makes it all sorts of funky
for some reason:

notebook.signal_connect_after(‘switch-page’) { |w,page,page_num| blah }

-pete


Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net’s Techsay panel and you’ll get the chance to share
your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

Peter J. wrote:

Switch to using signal_connect_after. Otherwise, you end up doing
something before Gtk::Notebook does, which makes it all sorts of funky
for some reason:

That’s the one! Thanks very much.
Martin.


Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net’s Techsay panel and you’ll get the chance to share
your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV