Here's some interactive code for testing the window creation hook.
my $w = Gtk2::Window->new; my $nb = Gtk2::Notebook->new; $nb->append_page (my $c = Gtk2::Label->new ('Test')); $nb->set_tab_detachable ($c, TRUE);
Gtk2::Notebook->set_window_creation_hook ( sub { my ($notebook, $page, $x, $y, $data) = @_;
my $new_window = Gtk2::Window->new; my $new_notebook = Gtk2::Notebook->new; $new_window->add ($new_notebook); $new_window->show_all; # Either do it manually and return undef, or ... #$notebook->remove ($page); #$new_notebook->append_page ($page); #return undef; # ... simply return the new notebook and let gtk+ do the work. return $new_notebook; });
$w->add ($nb); $w->signal_connect (destroy => sub { Gtk2->main_quit; }); $w->show_all; Gtk2->main;
1 POD Error
The following errors were encountered while parsing the POD:
Unknown directive: =comment
To install Gtk2, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Gtk2
CPAN shell
perl -MCPAN -e shell install Gtk2
For more information on module installation, please visit the detailed CPAN module installation guide.