Re: get_tab_label



I use the following to iterate over all the pages in a notebook
looking for one with a particular name:

my @children = $notebook->children;
foreach my $child (@children) {
    if ($notebook->get_tab_label($child->child)->get eq $name) {
        ....
        last;
    }
}

So you could use that to get every name. I don't remember if the
children array is page order or not though.

If you want to get the label of an ordered page number:

my @children = $notebook->children;
foreach my $child (@children) {
    if ($notebook->page_num($child->child) == $number) {
        $name = $notebook->get_tab_label($child->child)->get;
        last;
    }
}

Hope this is useful.
Gavin


AvA <a v a home nl> writes:

that works good, except that it only gets the labelname of the last tab
that is
open.
how can i get it to read the ones in the beginning or the middle?



Gavin Jefferies wrote:

As get_tab_label() returns a Gtk::Label you just need to add a get()
to that to get the text in the label. i.e.

  my $a = $notebook->get_tab_label($vscrolled)->get;

AvA <a v a home nl> writes:

hi all,

i am struggling with the notebook widget for a simple text editor.
i want to get the name of the current open notebook page.

i have the following structure in the notebookpage:
notebook->vscrolledwindow->text.

when i do this:

my $file_dialog = new Gtk::FileSelection("Save as...");
my $a = $notebook->get_tab_label($vscrolled);
$file_dialog->set_filename($a);
......

then i get the following from $a:

Gtk::Label=HASH(0x8196bdc)

how do i work around it so it just gives me the labelname...in this
case:
new.txt.

thanks


_______________________________________________
gtk-perl-list mailing list
gtk-perl-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list


_______________________________________________
gtk-perl-list mailing list
gtk-perl-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list




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