Basically all code is just a change of the elements defined in the Populate method.
$Gui::DlgProcessDelay::VERSION = 0.1;
package Gui::DlgProcessDelay;
use Tk::widgets qw/Label Button Entry/;
use base qw/Gui::DlgBasic/;
use strict;
use warnings;
use Carp qw/carp cluck/;
use Data::Dumper;
Construct Tk::Widget 'DlgProcessDelay';
# Initialising the object
#
sub ClassInit{
my ( $class, $mw ) = @_;
$class->SUPER::ClassInit( $mw );
} # END: ClassInit
# Populating the widget
sub Populate{
my ( $self, $args ) = @_;
$self->SUPER::Populate( $args );
$self->ConfigSpecs( -xlssource => [qw/METHOD xlssource XlsSource/],
-xlstarget => [qw/METHOD xlstarget XlsTarget/],
);
$self->{ _frmDelay } =
$self->Frame( -label => "Delay Data" )
->grid( -row => 0,
-column => 0,
-sticky => 'w' );
$self->{ _frmDelay }->Label( -text => "Delay Source:" )
->grid( -row => 0,
-column => 0,
-sticky => 'w' );
$self->{ _frmDelay }->Label( -text => "Import Delay Data:" )
->grid( -row => 0,
-column => 1,
-sticky => 'w' );
$self->{ _entDelayData } =
$self->{ _frmDelay }->Entry( -textvariable => \$self->{ _sXlsSourc
+e },
-borderwidth => 2,
-width => 60,
-relief => 'groove' )
->grid( -row => 1,
-column => 1,
-columnspan => 3,
-sticky => 'w' );
$self->{ _frmDelay }->Button( -text => "...",
-command => sub { $self->_getXlsSource(); } )
->grid( -row => 2,
-column => 2,
-sticky => 'w' );
$self->{ _frmDelay }->Button( -text => "Import File",
-command => sub { $self->_importXlsFile(); } )
->grid( -row => 2,
-column => 3,
-sticky => 'w' );
} # end Populate
# Configure the delay import sourcefile name
#
sub xlssource{
my $self = shift;
if ( @_ > 0 ) {
my $file = shift;
if ( -e $file ) {
$self->{ _sXlsSource } = $file;
} # END: if ( -e $file )
else {
cluck "You tried to load a file non-existing file.";
} # END: else ( -e $file )
} # END: if ( @_ > 0 )
else {
# cluck "Monitored a cget on option -ciffile.\n";
return $self->{ _sXlsSource }; # cget( ) requests here
} # END: else ( @_ > 0 }
}
# Configure the xls target name
#
sub xlstarget{
my $self = shift;
if ( @_ > 0 ) {
my $file = shift;
$self->{ _sXlsTarget } = $file;
} # END: if ( @_ > 0 )
else {
# cluck "Monitored a cget on option -ciffile.\n";
return $self->{ _sXlsTarget }; # cget( ) requests here
} # END: else ( @_ > 0 }
}
sub _getXlsSource{
my ( $self ) = @_;
my $file = Gui::Misc::open_file( $self, "xls" );
$self->configure( -xlssource => $file );
}
sub _importXlsSource{
print "Not yet implemented.\n";
}
sub _getXlsTarget{
my ( $self ) = @_;
my $file = Gui::Misc::save_file( $self, "xls" );
$self->configure( -xlstarget => $file );
}
1;
It seems to run fine through Populate. But hangs somewhere afterwards.
|