Tk-Wizard
view release on metacpan or search on metacpan
lib/Tk/Wizard.pm view on Meta::CPAN
our $VERSION = 2.086;
=head1 NAME
Tk::Wizard - GUI for step-by-step interactive logical process
=cut
use Carp;
use Config;
use Data::Dumper;
use File::Path;
use Tk;
use Tk::DialogBox;
use Tk::Frame;
use Tk::Font;
use Tk::MainWindow;
use Tk::ROText;
use Tk::Wizard::Image;
use Tk::JPEG;
use Tk::PNG;
use constant DEBUG_FRAME => 0;
use vars qw( @EXPORT @ISA %LABELS );
# use Log4perl if we have it, otherwise stub:
# See Log::Log4perl::FAQ
BEGIN {
eval { require Log::Log4perl; };
# No Log4perl so bluff: see Log4perl FAQ
if($@) {
no strict qw"refs";
*{__PACKAGE__."::$_"} = sub { } for qw(TRACE DEBUG INFO WARN ERROR FATAL);
}
# Setup log4perl
else {
no warnings;
no strict qw"refs";
require Log::Log4perl::Level;
Log::Log4perl::Level->import(__PACKAGE__);
Log::Log4perl->import(":easy");
# It took four CPAN uploads and tests to workout why
# one user was getting syntax errors for TRACE: must
# be the Mithrasmas spirit (hic):
if ($Log::Log4perl::VERSION < 1.11){
*{__PACKAGE__."::TRACE"} = *DEBUG;
}
*{__PACKAGE__."::LOGCROAK"} = *LOGCROAK;
*{__PACKAGE__."::LOGCONFESS"} = *Carp::confess;
}
require Exporter; # Exporting Tk's MainLoop so that
@ISA = ( "Exporter", ); # I can just use strict and Tk::Wizard without
@EXPORT = ("MainLoop"); # having to use Tk
}
use base qw[ Tk::Derived Tk::Toplevel ];
Tk::Widget->Construct('Wizard');
# See INTERNATIONALISATION
%LABELS = (
# Buttons
BACK => "< Back",
NEXT => "Next >",
FINISH => "Finish",
CANCEL => "Cancel",
HELP => "Help",
OK => "OK",
);
my $WINDOZE = ($^O =~ m/MSWin32/i);
my @PAGE_EVENT_LIST = qw(
-preNextButtonAction
-postNextButtonAction
-preBackButtonAction
-postBackButtonAction
);
my $REFRESH_MS = 1000; # Refresh the wizard every REFRESH_MS milliseconds
=head1 SYNOPSIS
use Tk::Wizard ();
my $wizard = new Tk::Wizard;
# OR my $wizard = Tk::MainWindow->new -> Wizard();
$wizard->configure( -property=>'value' );
$wizard->cget( "-property");
# $wizard->addPage(
# ... code-ref to anything returning a Tk::Frame ...
# );
$wizard->addPage(
sub {
return $wizard->blank_frame(
-title => "Page Title",
-subtitle => "Sub-title",
-text => "Some text.",
-wait => $milliseconds_b4_proceeding_anyway,
);
}
);
$wizard->addPage(
sub { $wizard->blank_frame(@args) },
-preNextButtonAction => sub { warn "My -preNextButtonAction called here" },
-postNextButtonAction => sub { warn "My -postNextButtonAction called here" },
);
$wizard->Show;
MainLoop;
exit;
To avoid 50 lines of SYNOPSIS, please see the files included with the
distribution in the test directory: F<t/*.t>. These are just Perl
programs that are run during the C<make test> phase of installation: you
can move/copy/rename them without harm once you have installed the module.
=head1 CHANGES
Please see the file F<Changes> included with the distribution for change history.
( run in 1.588 second using v1.01-cache-2.11-cpan-d7a12ab2c7f )