Re: thanks for your help with Gtk2::Buffer



On Sat, 22 Jan 2005 17:43:25 -0500
muppet <scott asofyet org> wrote:

I can't reproduce this.  If you could cut your program down to a 
minimal example that exhibits the problem, then we can help you debug 
it.

So, the 'interesting' part of my "program" is this:

my $view = Gtk2::TextView->new();
...
$menu_save->signal_connect("activate", \&save_buff);
...
sub save_buff {
        
        my $local_buff = $view->get_buffer;
        if($local_buff->get_char_count == 0) {
                        
                        my $dialog = Gtk2::MessageDialog->new($window, [qw/modal destroy-with-parent/], 'ok', 
'The buffer is empty.\nNothing to save.');
                        $dialog->run();
                        $dialog->destroy();
        }
        #my $f_chsr = Gtk2::FileChooserDialog->new("Save", $window, 'save', 'gtk-save', 'accept', 
'gtk-cancel', 'cancel');
        #if($f_chsr->run eq 'accept') {
        #       my $name = $f_chsr->get_filename;
                my $txt = $local_buff->get_text($local_buff->get_start_iter, $local_buff->get_end_iter, 
FALSE);
                print $txt;
        #       open(D, $name);
        #       print D $txt;
        #       close(D);
        #       $f_chsr->destroy;
        #}
        #else {
        #       $f_chsr->destroy;
        #}
        return;
}

If all it's ok in the code, it should print the buffer content on the terminal from which i run the script, 
but this not happen. I tried to save $txt to a file (which was my first intention) but it saves an empty file
 
 
 --
 Email.it, the professional e-mail, gratis per te: http://www.email.it/f
 
 Sponsor:
 Fai squillare il cellulare con le suonerie più originali
 Clicca qui: http://adv.email.it/cgi-bin/foclick.cgi?mid=3114&d=23-1



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