Re: notebook pages



Jens Wilke <jens wilke org> writes:

Hi,

how to switch to the last page of a notebook?
Gtk2::Notebook::set_current_page($notebook, -1);
or $notebook->set_current_page(-1);
does nothing, is it not yet implemented?

-=-=---=-=---=-=---=-=---=-=--
use Gtk2;
Gtk2->init;

my $w = Gtk2::Window->new('toplevel');
$w->set_position('center');

my $n = Gtk2::Notebook->new;
$n->append_page(Gtk2::Label->new('first page'));
$n->append_page(Gtk2::Label->new('second page'));
$n->append_page(Gtk2::Label->new('third page'));

my $b = Gtk2::Button->new('ok');
$b->signal_connect(clicked => sub { Gtk2->main_quit });
my $p = Gtk2::VBox->new(0, 10);
$p->pack_start($n, 1, 1, 0);
$p->pack_end($b, 0, 0, 0);
$w->add($p);
$w->show_all;

$n->set_current_page(-1);

Gtk2->main;
-=-=---=-=---=-=---=-=---=-=--

works for me.

you're probably trying to set the current page before the widget
is shown, isn't it? moving the set_current_page of my example
before $w->show_all will not "work" as expected.

And what's about get_n_pages?

Not still available. Adding it to CVS right now. Taking that as a
pretext to add other missing features and clean up a little
Notebook.c functions ordering.

-- 
Guillaume Cottenceau - http://people.mandrakesoft.com/~gc/



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]