Hello monks,

Basically I want to do something similar to a wizard, as in have several sequential windows stepping through. I can't seem to be able to get my 'next' button working properly. What I want it to do is call a sub, which would be the code of the next window, or a .pl file which contains the code for the next window and then exit the current one.
To help you understand here is an example of something similar to what I want to do (with the same problem I have, but I did it to make it easier to locate the problem):

use Tk; my $mw = MainWindow->new; $mw->title("Window1"); $mw->MainWindow->Frame(-relief=>'groove'); $mw->minsize(600,300); my $welcome = $mw-> Message(-font => '16', -text =>"Hello World!")->pa +ck(-side => 'left', -anchor=>'ne'); my $bf = $mw-> Frame(-pady => '5')->pack(-side => 'bottom', -anchor=>' +se'); my $cancel = $bf -> Button(-relief=> 'raised', -borderwidth => '2', -t +ext => "Cancel", -command => sub { exit })->pack(-side => 'right',-pa +dx => '20'); my $next = $bf -> Button(-relief=> 'raised', -borderwidth => '2', -tex +t => "Next", -command => sub { \&rep2 , exit})->pack(-side => 'right' +); my $back = $bf -> Button(-state => 'disabled', -relief=> 'raised', -bo +rderwidth => '2', -text => "Back")->pack(-side => 'right'); MainLoop; sub rep2 { my $rep2 = MainWindow->new; $rep2->tittle("Window2"); $rep2->minsize(600,300); my $bf = $rep2-> Frame(-pady => '5')->pack(-side => 'bottom', -anc +hor=>'se'); my $msg = $rep2-> Message(-text => "This is the second window.")-> +pack(); my $finish = $bf -> Button(-relief=> 'raised', -borderwidth => '2' +, -text => "Finish", -command => sub{exit})->pack(-side => 'right'); + MainLoop; }
This doesn't seem to work and in the -command of the "next" button if I put: -command => \&rep2 instead it creates new random empty windows and doesn't recognize the tittle or minimum size set for it.Could you please help me?

Thank you for your efforts :)


In reply to Next Window by perlNoob

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.