Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
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

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

  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?

What's my password?
Create A New User
Domain Nodelet?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (2)
As of 2023-09-28 21:36 GMT
Find Nodes?
    Voting Booth?

    No recent polls found