diarmuid has asked for the wisdom of the Perl Monks concerning the following question:
After banging my head against this yesterday I figured that this might be my best option to relieve the pain :-)
I am trying to write a simple wizard using perl/tk and specifically using the Tk::Wizard CPAN module. I have written a simple wizard that does nothing much but contains two pages. The problem is that when I select the Next page (frame) the Previous page is also kept. So in effect I have on page1 frame1 and on page2, frame1&frame2.
It took me a while to notice this as I had to resize the window to see the second frame after clicking Next.
Code is below and hopefully someone might have some idea as to what I am doing incorrectly.
Diarmuid
#!/usr/local/bin/perl5.8.3 -w use lib '/cdb/omap4ExtSetup/ind/lib/site_perl/5.8.3/'; use strict; use English; use Tk::Wizard; my $wizard = new Tk::Wizard; my %ocp_description; # MASTER OR SLAVE selection print $wizard->addPage( sub { page_one($wizard)} ) , "\n"; ## READ OR WRITE print $wizard->addPage ( sub { page_two($wizard)}), "\n"; $wizard->Show; MainLoop; exit; sub page_one { my $wizard = shift; $wizard->{backButton}->configure(-state=>'disable'); $wizard->{nextButton}->configure(-state=>'disable'); my $frame = $wizard->blank_frame ( -title => "Master or Slave Interface", -text => "Please select the type of interface on your module" +, -borderwidth => 2, ); my $slave_cb = &add_check_button($frame,"slave"); my $master_cb = &add_check_button($frame,"master"); $master_cb->configure (-command => sub { if ($ocp_description{master} == 1) { $slave_cb->configure(-state => 'disabled'); $wizard->{nextButton}->configure(-state=>'active'); }else{ $slave_cb->configure(-state => 'active'); $wizard->{nextButton}->configure(-state=>'disable'); } }); $slave_cb->configure (-command => sub { if ($ocp_description{slave} == 1) { $master_cb->configure(-state => 'disabled'); $wizard->{nextButton}->configure(-state=>'active'); }else{ $master_cb->configure(-state => 'active'); $wizard->{nextButton}->configure(-state=>'disable'); } }); $master_cb->pack(); $slave_cb->pack(); } sub page_two { my $wizard = shift; my $frame = $wizard->blank_frame ( -title => "Read or write", -text => "Does your module support the following", -borderwidth => 2, ); my $read_cb = &add_check_button($frame,"read"); my $write_cb = &add_check_button($frame,"write"); my $writenonpost_enable_cb = &add_check_button($frame,"writenonpost +_enable"); $write_cb->configure (-command => sub { if ($ocp_description{write} == 0) { $writenonpost_enable_cb->configure(-state => 'disabled'); }else{ $writenonpost_enable_cb->configure(-state => 'active'); } }); $read_cb->pack(); $write_cb->pack(); $writenonpost_enable_cb->pack(); } sub add_check_button { my $frame = shift; my $tag = shift; my $comment = shift; if (! defined $comment){ $comment = $tag; } my $cb = $frame->Checkbutton (-text => $comment, -variable => \$ocp_description{$tag}, ); return $cb; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Tk::Wizard not redrawing window correctly
by johngg (Canon) on Mar 07, 2007 at 11:10 UTC | |
by diarmuid (Beadle) on Mar 07, 2007 at 15:49 UTC | |
|
Re: Tk::Wizard not redrawing window correctly
by diarmuid (Beadle) on Mar 07, 2007 at 08:51 UTC |