|
From: Marcus <li...@wo...> - 2002-06-01 11:05:36
|
I've tried the splashscreen in a larger app. It works nicely if placed
inside MyFrame (appears earlier than in OnInit).
I only need some help on how to place it in BEGIN { }. Otherwise, Perl
reads the whole file and modules first, making the splash only partly
useful, due of the time lapse.
First problem is that Wx::SplashScreen crashes if no parent is given.
In the docs they use NULL in C++, but undef does not work in WxPerl.
So I tried creating a new Frame, but just a grey splash appears and
then Perl crashes.
BEGIN{
use Wx qw( wxDefaultPosition wxDefaultSize);
use SplashScreenDemo;
my( $frame ) = Wx::Frame->new( undef, -1, "Splash", [20,20], [200,250]
);
SplashScreenDemo::window($frame);
}
Here's SplashScreenDemo:
sub window {
shift;
my $parent = shift;
my $panel = Wx::Panel->new( $parent, -1 );
my $bitmap = Wx::Bitmap->new( './logo.jpg',
wxBITMAP_TYPE_JPEG );
Wx::SplashScreen->new( $bitmap,
wxSPLASH_CENTRE_ON_SCREEN|wxSPLASH_TIMEOUT, 2000, $panel,
-1,wxDefaultPosition, wxDefaultSize, wxSIMPLE_BORDER|wxSTAY_ON_TOP);
}
I'm not sure why the demo uses a panel, but I also tried placing the
splash directly on the window/frame, but that didn't make any
difference.
Marcus
|