in reply to Re: Simple wxWizard application
in thread Simple wxWizard application

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