Dear Monks,

What am I doing wrong here ...

What I am trying to do:
I am trying to popup a dialog box
that has Notebook tabs in it.

Here's the error I am getting
$ ./blah.pl Tk::Error: Failed to AUTOLOAD 'Tk::Frame::add' at ./blah.pl line 34 [\&main::callback,\{},View orders] (menu invoke)

Here's my messed up code:
#!/usr/bin/perl -w use strict; use Tk; use Tk qw(exit); use TK::Menubar; use Tk::DialogBox; use Tk::Notebook; use Tk::RoText; my $top = MainWindow->new(); my $mb = $top->Menubar; my $m1 = $mb->Menubutton ( -text => 'File' ); $m1->command( -label => 'Blah 1', -command => [sub { print "Blah 1\n"; }] ); my $m2 = $mb->Menubutton ( -text => 'Orders' ); $m2->command( -label => 'View Orders', -command => [\&callback, \$top, "View orders"] ); my $m3 = $mb->Menubutton ( -text => 'Customers' ); $m3->command( -label => 'View Customers', -command => [\&callback, \$top, "View Customers"] ); my $ro = $top->ROText()->pack( -anchor => 'n', -expand => 'both'); MainLoop(); sub callback { my $t = shift || $top; my $title = shift || "Unknown"; my $FILE1 = "whatever"; my $FILE2 = "something"; my $dd = $$t->DialogBox( -title => $title ); #->Frame(); my $d = $dd->Frame()->pack(); my $n = $d->NoteBook()->pack( -expand => 0, -fill => 'x' ); #, + -in => $$t); my $p = $n->add( 'page1', -label => $title ); my $e1 = $p->add( 'Entry', -width => 60, -textvariable => \$FILE1 )->pack(); my $b1 = $p->add( 'Button', -width => 10, -text => 'File 1', -command => [sub { print "$FILE1\n"; }]); my $b2 = $p->add( 'Button', -width => 10, -text => 'Details', -command => [\&callback, \$d, "Details"] ); $e1->pack(); $b1->pack(); $b2->pack(); $d->Show(); }

Is it just not possible to do this?
I am sure there is a way ... please help!

In reply to Tk::NoteBook tabs in a Tk::Dialog question by rbc

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.