As you can see from earlier posts, you haven't provided sufficient information for us to help you. I won't say any more about that; however, please read "How do I post a question effectively?" and "Short, Self-Contained, Correct Example" before posting again.

I suspect you're confusing Tk::Entry with the word "entry" used by Tk::Menu. From its doco (my emphasis):

"A menu is a widget that displays a collection of one-line entries ... There exist several different types of entries, ... Entries of different types may be combined in a single menu. Menu entries are not the same as entry widgets. In fact, menu entries are not even distinct widgets; the entire menu is one widget. ..."

You later wrote:

"I need to get the dirname from Tk::Enter so I can build a command line and execute it."

[Yes, you did write Tk::Enter. You need to be careful about that sort of thing.]

I think the following might form the guts of what you're attempting. It's fully functional as is. You'll need to get $dir into your command line, instead of displaying it in a label. Once you have the basic functionality working, add cosmetics (colours, fonts, borders, etc.).

#!/usr/bin/env perl use strict; use warnings; use Tk; my $mw = Tk::MainWindow::->new(); my $dir = ''; my $menu_F = $mw->Frame()->pack(-fill => 'x'); my $label_F = $mw->Frame()->pack(-fill => 'both', -expand => 1); $label_F->Label(-textvariable => \$dir)->pack; my $menutop = $menu_F->toplevel(); my $menubar = $menutop->Menu(-type => 'menubar'); $menutop->configure(-menu => $menubar); my $file_menu = $menubar->Cascade( -label => 'File', -tearoff => 0, -menuitems => [ [ Button => 'Get Dir', -command => sub { $dir = $mw->chooseDirectory; }], [ Button => 'Exit', -command => sub { exit } ], ], ); MainLoop;

See also: Tk and Tk::chooseDirectory.

— Ken


In reply to Re: GETTING the input from a cascading menu by kcott
in thread GETTING the input from a cascading menu by Anonymous Monk

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.