Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

comment on

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



  • 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?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (2)
As of 2024-04-24 23:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found