Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister

Next Window

by perlNoob (Acolyte)
on Feb 23, 2005 at 23:14 UTC ( #433897=perlquestion: print w/replies, xml ) Need Help??

perlNoob has asked for the wisdom of the Perl Monks concerning the following question:

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 :)

Replies are listed 'Best First'.
Re: Next Window
by esskar (Deacon) on Feb 23, 2005 at 23:50 UTC
      No I didn't know it. Thanks a lot I think that might be a huge help, I'll have to give it a go. :)

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://433897]
Approved by Tanktalus
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (3)
As of 2023-06-09 15:47 GMT
Find Nodes?
    Voting Booth?
    How often do you go to conferences?

    Results (36 votes). Check out past polls.