Slaven Rezić > Tk-Splash-0.14 > Tk::FastSplash

Download:
Tk-Splash-0.14.tar.gz

Dependencies

Annotate this POD

CPAN RT

Open  0
View/Report Bugs
Module Version: 0.15   Source  

NAME ^

Tk::FastSplash - create a fast starting splash screen

SYNOPSIS ^

    BEGIN {
        require Tk::FastSplash;
        $splash = Tk::FastSplash->Show($image, $width, $height, $title,
                                   $overrideredirect);
    }
    ...
    use Tk;
    ...
    $splash->Destroy if $splash;
    MainLoop;

DESCRIPTION ^

This module creates a fast loading splash screen for Perl/Tk programs. It uses lowlevel Perl/Tk stuff, so upward compatibility is not given (the module should work at least for Tk800.015, .022, .024, .025 and Tk804.025, but does not work with newer ActivePerl versions).

The splash screen is created with the Show function. Supplied arguments are: filename of the displayed image, width and height of the image and the string for the title bar. $width and $height may be left undefined. If $overrideredirect is set to a true value, then the splash screen will come without window manager decoration. If something goes wrong, then Show will silently ignore all errors and continue without a splash screen. The splash screen can be destroyed with the Destroy method, best short before calling MainLoop.

If you want to run this module on a Tk402.xxx system, then you have to set the variable $Tk::FastSplash::TK_VERSION to a value less than 800.

$image should be one of the core Perl/Tk image types (gif, ppm, bmp). For jpegs and pngs, a use Tk::JPEG or use Tk::PNG prior to the call of the Show method would be necessary, but calling one of these two would slurp the whole Tk module in, making the point of FastSplash useless.

CAVEAT ^

This module does forbidden things e.g. bootstrapping the Tk shared object or poking in the Perl/Tk internals. Because of this, this module can stop working in a new Perl/Tk release. If you are concerned about compatibility, then you should use Tk::Splash instead. If your primary concern is speed, then Tk::FastSplash is for you (and the primary reason I wrote this module). The splash window of Tk::FastSplash should pop up 1 or 2 seconds faster than using Tk::Splash or a vanilla Tk::Toplevel window.

BUGS ^

Probably many.

If used with newer ActivePerl (e.g. build 811), then it is possible that the application becomes unusable by using strange characters.

You cannot call Tk::FastSplash twice in one application.

The $^W variable should be turned off until the "use Tk" call.

If FastSplash is executed in a BEGIN block (which is recommended for full speed), then strange things will happen when using perl -c or trying to compile a script: the splash screen will always pop up while doing those things. Therefore it is recommended to disable the splash screen in check or debug mode:

    BEGIN {
        if (!$^C && !$^P) {
            require Tk::FastSplash;
            $splash = Tk::FastSplash->Show($image, $width, $height, $title,
                                           $overrideredirect);
        }
    }

The -display switch is not honoured (but setting the environment variable DISPLAY will work).

XXX Avoid Win32 raise/lower problem with this code (maybe)?

    # Windows constants
    my ($ONTOP, $NOTOP, $TOP) = (-1, -2, 0);
    my ($SWP_NOMOVE, $SWP_NOSIZE) = (2, 1);
    
    my $SetWindowPos        = new Win32::API("user32", "SetWindowPos", 'NNNNNNN', 'N'); 
    my $FindWindow          = new Win32::API("user32", "FindWindow", 'PP', 'N'); 
    
    # Reestablish Z order
    my $class = "TkTopLevel";
    my $topHwnd = $FindWindow->Call($class, $w->title);
    $topHwnd and $SetWindowPos->Call($topHwnd, $ONTOP, 0, 0, 0, 0, $SWP_NOMOVE | $SWP_NOSIZE);

AUTHOR ^

Slaven Rezic (slaven@rezic.de)

SEE ALSO ^

Tk::Splash, Tk::ProgressSplash, Tk::Splashscreen, Tk::mySplashScreen.

syntax highlighting: