InheritThis is deprecated - use SUPER:: at ..... 
Author Message
 InheritThis is deprecated - use SUPER:: at .....

hi experienced guys!

what's about this message?
InheritThis is deprecated - use SUPER:: at......

this little program caused th problem

#!/usr/local/bin/perl -w

use Tk;
require "<your_path_to>/SaveFile.pm";

my $main = new MainWindow;
my $next = $main -> Button(-text => 'Next',-command => \&next)->pack;

sub next {
 my $submain =$main->Toplevel;
 my $next = $submain -> Button(-text => 'Next2',-command =>
sub{next2($submain)})->pack;

Quote:
}

sub next2 {

 my $cw = $submain->SaveFile;
 my ($dir,$file)=$cw->show;
 print "Directory: $dir  File: $file\n";

Quote:
}

####USED PACKAGE###############

package Tk::SaveFile;

use Carp;
use strict qw(vars);

Tk::Widget->Construct('SaveFile');

my $dir_entry;
my $file_entry;

sub Populate
{

    $cw->InheritThis($args);

    my ($but,$pad1,$pad2);

    $cw->{'selected_button'} = '';

    ($pad1, $pad2) =
        ([-padx => '3m', -pady => '3m'], [-padx => '3m', -pady => '2m']);

    $cw->withdraw;
    $cw->iconname('FileStore');
    $cw->protocol('WM_DELETE_WINDOW' => sub {});
    $cw->transient($cw->toplevel);

    my $top = $cw->Frame(Name => 'top',-relief => 'raised', -borderwidth => 1);
    my $bot = $cw->Frame(Name => 'bot',-relief => 'raised', -borderwidth => 1);



    my $top_left  = $top->Frame;
    my $top_right = $top->Frame;

    $dir_entry = $top_right -> Entry();
    $dir_entry -> pack;
    $dir_entry -> configure (-relief => 'groove');
    my $dir = $ENV{PWD}.'/';
    $dir_entry->insert(0,$dir);

    my $dir_label = $top_left -> Label(-text=>'Directory')->pack;

    $file_entry = $top_right -> Entry();
    $file_entry -> pack;
    $file_entry -> configure (-relief => 'groove');
    my $default = 'file.txt';
    $file_entry->insert(0,$default);

    my $file_label = $top_left -> Label(-text=>'Filename')->pack;

    $top_left->pack(-side=>'left');
    $top_right->pack(-side=>'left');


    my $default_button = 0;

    my($w_default_button, $bl) = (undef, '');

        $but = $bot->Button(
            -text => $bl,
            -command => [
                sub {
                    $_[0]->{'selected_button'} = $_[1];
                }, $cw, $bl,
            ]
        );
        if ($bl eq $default_button) {
            $w_default_button = $bot->Frame(
                -relief      => 'sunken',
                -borderwidth => 1
            );
            $but->raise($w_default_button);

            $but->pack(-in => $w_default_button, -padx => '2m',
                         -pady => '2m');
            $cw->bind(
                '<Return>' => [
                    sub {
                        $_[1]->flash;
                        $_[2]->{'selected_button'} = $_[3];
                    }, $but, $cw, $bl,
                ]
            );
        } else {

        }
    } # forend all buttons

   $cw->{'default_button'} = $w_default_button;

Quote:
}

sub show {

     croak "Dialog:  `show' method requires at least 1 argument"

    $cw->Popup();
     my ($file_name,$dir_name);

    $cw->tkwait('variable' => \$cw->{'selected_button'});

   if ($cw->{'selected_button'} =~ /Accept/) {
       $dir_name  = $dir_entry -> get;
       $file_name = $file_entry -> get;
    }
    $cw->grab('release');
    $cw->withdraw;

    return ($dir_name,$file_name);

Quote:
}

1;


Sat, 17 Apr 1999 03:00:00 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. SUPER SUPER Newbie Question

2. Using a hash as a reference is deprecated

3. How to change code using deprecated features?

4. what used to work is now deprecated?

5. Using goto & with SUPER::

6. How am I using sort wrong?

7. Finding out what telnet port I am using

8. Easily using databases - am I reinventing a wheel?

9. How much memory am I using?

10. deprecated do's

11. $n=split("\n",$arrgh) deprecated

12. $* deprecated

 

 
Powered by phpBB® Forum Software