How added new page in notebook?

Hi All,

Hi All,

I’m a newbie at ruby GUI. I learning how to append a page in the
notebook on the fly by attaching a function to a button. The idea is to
add/delete a page everytime I press the button. By using this way, I
could delete a page in the notebook on the fly but I couldn’t add a page
in the notebook on the fly. Anybody know how to add the page in the
notebook on the fly? I didn’t receive any error message but I didn’t see
any new page added to the notebook.

Below are the methods that I used to remove/add page to the notebook:

def remove_book( button, notebook )
page = notebook.page
notebook.remove_page( page )
end

def add_book( button, notebook)
checkbutton = Gtk::Button.new( “Check me please!” )
label = Gtk::Label.new( “Add Page” )
notebook.insert_page( 2, checkbutton, label)
end

Thanks for your input.

fjimmy

Jimmy Fnu wrote:

def add_book( button, notebook)
checkbutton = Gtk::Button.new( “Check me please!” )
label = Gtk::Label.new( “Add Page” )
notebook.insert_page( 2, checkbutton, label)
end

Try:

def add_book( button, notebook)
checkbutton = Gtk::Button.new( “Check me please!” )
label = Gtk::Label.new( “Add Page” )
notebook.insert_page( 2, checkbutton, label)

checkbutton.show
label.show
end

best,
Dan


This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

Hi Dan,

It’s working.
Thanks:)

fjimmy

Daniel L. wrote:

def add_book( button, notebook)
checkbutton = Gtk::Button.new( “Check me please!” )
label = Gtk::Label.new( “Add Page” )
notebook.insert_page( 2, checkbutton, label)

checkbutton.show
label.show
end

best,
Dan


This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/