re: get_tab_label



yes thats very usefull indeed, but it still saves the last text file
opened.
i have a notebook with multiple opened windows with the following
structure:
notebook->scrolledwindow->text.

so when i have 3 tabs open and i want to save the 1st file...it gives me
the right filename but still save the text in the last file to the 1st
file.

heres a snip of my code:

 my ($widget,$file_selection, $name)= @_;

        my $entry_text = $text->get_chars();
        open (FILE, ">$name");
        print FILE "$entry_text\n";
        close FILE;
        $file_selection->hide;

......








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





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