<?xml version="1.0" encoding="windows-1252"?>
<node id="1011789" title="Re: WxPerl Next button" created="2013-01-05 09:20:18" updated="2013-01-05 09:20:18">
<type id="11">
note</type>
<author id="982107">
jmlynesjr</author>
<data>
<field name="doctext">
&lt;p&gt;After reviewing and running your code, and having read a zillion of theses posts now, I knew that a more learned Monk would suggest using one of the CPAN XML parsers. Thanks [stefbz]. I have not gotten into XML at all yet.&lt;/p&gt;

&lt;p&gt;I do think that you should be using a dialog(modal) rather than individual controls. I would start with the wxSingleChoiceDialog and use it to get my application logic correct. Build and popup the dialog, extract your answer, destroy the popup, then repeat for all of your questions. Then if you still want a different look and feel you could implement a custom dialog like the wxSingleChoiceDialog, but using radio boxes instead of a list. See CppTrial-pg225.pl for the wxSingleChoiceDialog example and CppTrial-pg245.pl for the PersonalRecordDialog custom dialog example.&lt;/p&gt;

&lt;p&gt;The next more complicated option would be to create a wxWizard. Unfortunately I haven't yet implemented the wxWizard example from the "wxBook" in my github examples.&lt;/p&gt;

&lt;p&gt;See also the wxDemo wxWizard and wxSingleChoiceDialog examples. I run Citrus Perl 5.16 and on my system these can be found at home/CitrusPerl/perl/vendor/bin/wxperl_demo.pl. Look under the Managed Windows and Dialogs sections.&lt;/p&gt;

&lt;p&gt;Please repost your working application to add to the example base.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Update1:&lt;/b&gt;See if the following code can be integrated with your XML code.&lt;/p&gt;

&lt;readmore&gt;&lt;code&gt;#!/usr/bin/perl

# Highly Modified CppTrial-pg225.pl in Answer to Perl Monks question
# Cross-Platform GUI Programming with wxWidgets - Smart, Hock, &amp; Csomor
# C++ Example from pg 225 - Single Choice Dialog
# Ported to wxPerl by James M. Lynes Jr. - Last Modified 1/5/2013

use 5.010;
use strict;
use warnings;
use Wx qw(:everything);
use Wx::Event qw(EVT_PAINT);

# create the WxApplication
my $app = Wx::SimpleApp-&gt;new;
my $frame = Wx::Frame-&gt;new(undef, -1, 'Company Survey', wxDefaultPosition, wxDefaultSize);

# Parse your XML into $title, $question, &amp; @choices and pass into subroutine, loop for all questions
myStdDialogs1($frame);						# Duplicate calls to simulate a loop
myStdDialogs2($frame);						# Duplicate calls to simulate a loop

$frame-&gt;Show;
$app-&gt;MainLoop;
 
sub myStdDialogs1 {
	my ( $self ) = @_;
        my $title = "Survey question: TNHSCS010001";		# Hard coded for example...pass in, in live code
	my $question = "Jenkins is primiary used of ........?";
	my @choices = ("1 Nightly Builds",
	               "3 CI Builds",
	               "4 Report Generation",
	               "1 All the above");
			
	my $singleChoiceDialog = Wx::SingleChoiceDialog-&gt;new($self, $question, $title, \@choices);
	if( $singleChoiceDialog-&gt;ShowModal() == wxID_OK) {
		Wx::MessageBox($singleChoiceDialog-&gt;GetStringSelection(),
		"Selected Answer", wxOK | wxICON_INFORMATION, $self);
	}
	$singleChoiceDialog-&gt;Destroy;
}
 
sub myStdDialogs2 {
	my ( $self ) = @_;
        my $title = "Survey question: TNHSCS010001";		# Hard coded for example...pass in, in live code
	my $question = "Jenkins is primiary used of ........?";
	my @choices = ("1 Nightly Builds",
	               "3 CI Builds",
	               "4 Report Generation",
	               "1 All the above");
			
	my $singleChoiceDialog = Wx::SingleChoiceDialog-&gt;new($self, $question, $title, \@choices);
	if( $singleChoiceDialog-&gt;ShowModal() == wxID_OK) {
		Wx::MessageBox($singleChoiceDialog-&gt;GetStringSelection(),
		"Selected Answer", wxOK | wxICON_INFORMATION, $self);
	}
	$singleChoiceDialog-&gt;Destroy;
}&lt;/code&gt;&lt;/readmore&gt;

&lt;p&gt;&lt;b&gt;Update2:&lt;/b&gt;Just for completeness a wxWizard example follows.&lt;/p&gt;

&lt;readmore&gt;&lt;code&gt;#!/usr/bin/perl

# wxWizard.pl
# Adapted from wxperl_demo.pl from the wxPerl distribution
# James M. Lynes Jr. - Last Modified 1/6/2013

use 5.010;
use strict;
use warnings;

use Wx qw(:everything);
use Wx::Event qw(EVT_WIZARD_PAGE_CHANGED EVT_BUTTON EVT_WIZARD_FINISHED EVT_WIZARD_CANCEL);

# create the WxApplication

my $app = Wx::SimpleApp-&gt;new;

    my $frame = Wx::Frame-&gt;new( undef, -1,'wxWizard.pl', wxDefaultPosition, wxDefaultSize );

    my $panel = Wx::Panel-&gt;new($frame, -1, wxDefaultPosition, wxDefaultSize);
    Wx::StaticText-&gt;new($panel, -1, "WxWizard Sample Program", Wx::Point-&gt;new(100,100),
                        Wx::Size-&gt;new(200,200), wxALIGN_CENTER);

    my $button = Wx::Button-&gt;new( $panel, -1, "Start Wizard", Wx::Point-&gt;new(150, 225), wxDefaultSize );

    Wx::InitAllImageHandlers();
    my $bmp = Wx::Bitmap-&gt;new("logo.png", wxBITMAP_TYPE_PNG);
    my $wizard = Wx::Wizard-&gt;new( $panel, -1, "Wizard Example", $bmp );

    # first page
    my $page1 = Wx::WizardPageSimple-&gt;new( $wizard );
    Wx::TextCtrl-&gt;new( $page1, -1, "First page", wxDefaultPosition, Wx::Size-&gt;new(200,25) );

    # second page
    my $page2 = Wx::WizardPageSimple-&gt;new( $wizard );
    Wx::TextCtrl-&gt;new( $page2, -1, "Second page", wxDefaultPosition, Wx::Size-&gt;new(200,25) );

    # third page
    my $page3 = Wx::WizardPageSimple-&gt;new( $wizard );
    Wx::TextCtrl-&gt;new( $page3, -1, "Third page", wxDefaultPosition, Wx::Size-&gt;new(200,25) );

    # fourth page
    my $page4 = Wx::WizardPageSimple-&gt;new( $wizard );
    Wx::TextCtrl-&gt;new( $page4, -1, "Fourth page", wxDefaultPosition, Wx::Size-&gt;new(200,25) );

    Wx::WizardPageSimple::Chain( $page1, $page2 );
    Wx::WizardPageSimple::Chain( $page2, $page3 );
    Wx::WizardPageSimple::Chain( $page3, $page4 );

    EVT_BUTTON( $panel, $button, sub {$wizard-&gt;RunWizard( $page1 ); } );
    EVT_WIZARD_CANCEL( $panel, $wizard, sub {Wx::Wizard-&gt;Destroy();} );
    EVT_WIZARD_FINISHED($panel, $wizard, sub { Wx::Wizard-&gt;Destroy(); } );

#    Testing Messages comment out matching event above
#    EVT_WIZARD_FINISHED($panel, $wizard, sub { Wx::LogMessage( "Wizard Canceled" ); } );
#    EVT_WIZARD_PAGE_CHANGED( $panel, $wizard, sub {Wx::LogMessage( "Wizard page changed" ); } );
#    EVT_WIZARD_CANCEL( $panel, $wizard, sub {Wx::LogMessage( "Wizard Canceled" ); } );

$frame-&gt;Show;
$app-&gt;MainLoop;&lt;/code&gt;&lt;/readmore&gt;

&lt;p&gt;James&lt;/p&gt;
&lt;div class="pmsig"&gt;&lt;div class="pmsig-982107"&gt;
&lt;p&gt;There's never enough time to do it right, but always enough time to do it over...&lt;/p&gt;
&lt;/div&gt;&lt;/div&gt;</field>
<field name="root_node">
1011675</field>
<field name="parent_node">
1011675</field>
</data>
</node>
