in reply to Simple wxWizard application

I've never actually used this module but I just happened to be looking into it and found a tutorial which might be applicable to your problem: the "Adding interaction" example of http://www.perl.com/lpt/a/588. Note that the Event class is used in a different package than the OnInit subroutine.

Replies are listed 'Best First'.
Re^2: Simple wxWizard application
by TGI (Parson) on Nov 06, 2007 at 16:52 UTC

    Thanks for the idea. Events are the key. I just started a one shot timer to trigger the wizard after the main loop is started.

    use strict; use warnings; use Wx; package WizTest; use base qw(Wx::App); # Inherit from Wx::App use Wx::Event qw(EVT_WIZARD_FINISHED EVT_WIZARD_CANCEL EVT_TIMER); sub OnInit { my $self = shift; my $wizard = Wx::Wizard->new( undef, -1, "Wizard test" ); # first page my $page1 = Wx::WizardPageSimple->new( $wizard ); Wx::TextCtrl->new( $page1, -1, "First page" ); # second page my $page2 = Wx::WizardPageSimple->new( $wizard ); Wx::TextCtrl->new( $page2, -1, "Second page" ); Wx::WizardPageSimple::Chain( $page1, $page2 ); # use a timer to start the wizard after we have the event loop run +ning. my $timer = Wx::Timer->new(); $timer->Start( 50, 1 ); EVT_TIMER( $self, $timer, \&StartWizard ); EVT_WIZARD_FINISHED( $self, $wizard, 'WizardFinished' ); EVT_WIZARD_CANCEL( $self, $wizard, 'WizardFinished' ); $self->{wizard} = $wizard; $self->{start_page} = $page1; } sub StartWizard { my $self = shift; $self->{wizard}->RunWizard( $self->{start_page} ); } sub WizardFinished { my $self = shift; warn "Wizard finished: $self @_\n"; $self->{wizard}->Destroy; return; } package main; my $app = WizTest->new(); # New HelloWorld application $app->MainLoop; warn "Exited main loop";


    TGI says moo