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

I am trying to create a wizard. I want to create a frame and then pass that entire frame to the wizard addpage or blankframe. The only option is -text but it doesn't do what I expect. Instead it prints something like this Tk::DialogBox=HASH(0x2fd2e34). Does anyone know how to pass an entire frame or dialogbox to Tk-Wizard? Here's my code.
my $user_wizard = new Tk::Wizard( -title => " User Wizard", ); my $dlg = $user_wizard->DialogBox(-title=>'User Wizard', -buttons=>["O +K", "Cancel"]); $user_wizard->addPage( sub { return $user_wizard->blank_frame( -title => "Page Title", -subtitle => "Sub-title", -text => $dlg, ); }); $user_wizard->Show; MainLoop; __END__

Replies are listed 'Best First'.
Re: Tk::Wizard content
by zentara (Cardinal) on Apr 18, 2006 at 19:50 UTC
    I've never used Tk::Wizard, but the code does what it is asked to do. The $dlg is the Tk::DialogBox, so when you print it, it tells you what it's ref is in -text . What are you trying to do?

    I'm not really a human, but I play one on earth. flash japh
      I am trying to display the dialog box not display the address of it. I want the contents of the dialog box to show up as the Wizard page. Doesn't have to be a dialog box. It can be a Frame that has labels in it.
        You don't want to use a DialogBox then. A DialogBox will create it's own toplevel window to be in, it isn't like a frame.

        I still don't know what your overall software is supposed to do. It sounds like you want to get some inforamtion from a popup, then feed the results from the popup to some other frame?

        Tk widgets are like complex jigsaw puzzle pieces. They have to be fit together properly, or they won't work.

        Maybe you could get the result from a DialogBox, then feed that output to the Wizard? Maybe use the $letter from this script, and use that for your -text option in the Wizard?

        #!/usr/bin/perl use Tk; use Tk::DialogBox; my $mw = MainWindow->new; my $dialog = $mw->DialogBox( -buttons => [qw/Ok Cancel/], -title => "Enter New Value" ); my $dialogE = $dialog->add("Entry"); $dialogE->pack(qw/-padx 10 -pady 10/); my $button = $mw->Button( -text => "Get new value...", -command => [ \&getNewValue, $dialog, $entry ] )->pack(qw/-side left -padx 10/); MainLoop; sub getNewValue { my ( $db, $entry ) = @_; my $dbEntry = $db->Subwidget('entry'); ## Clear the Entry before showing the dialog $dbEntry->delete( 0, 'end' ); ## Determine whether or not the user hit "Ok" my $button = $db->Show(); if ( $button eq "Ok" ) { my $letter = $dbEntry->get(); print "$letter was submitted\n"; } } __END__

        I'm not really a human, but I play one on earth. flash japh