Re: saving from a menu bar



On 04/15/01 AvA wrote:
So i created a menu with the help of that tutorial.
Here is a snip:
........
{ path        => '/File/_Save',
                         accelerator => '<control>S',
                         callback    => \&save, $window,$text },

This won't make $window and $text additional arguments for the callback,
but they will become a key and value pair in a hash, not very useful.
You may want to change that to: 
        callback => sub {save($window,$text)},
and eliminate the $widget argument from the callback.

sub save {
        my ($widget, $window,  $text) = @_;
        my $entry_text = $text->get_chars();

Note that potentially this is a lot of data, so it's better to do 
it in chunks.

        open (FILE, ">$textfile");
        print FILE "$entry_text\n";
        close FILE;
}

This complains cos im not pasing the right stuff to the subroutine
("Can't call method "get_chars" on an undefined value at ...")

How do i pass the right stuff in the callback?

See above. ItemFactories do not support additional data in the
callback unless you build an item at a time...

lupus

-- 
-----------------------------------------------------------------
lupus debian org                                     debian/rules
lupus ximian com                             Monkeys do it better




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