I apologize for the vaugeness. I originally posted this under gui q+a and for some reason was assuming questions were ususally about perl/tk.

Anyway, here is an example of some code:

#!/usr/local/bin/perl use Tk; my $main = new MainWindow; $help_mb = $main->Menubutton(-text => "Help", -bg => '#bdc4c2', -tearoff => '0', -activebackground => '#bdc4c2', -relief => 'raised', -menuitems => [ [ 'command' => "quit +", "-command" => \&my_ +quit, "-underline" => 0 ] ], )->pack(-side => 'right'); MainLoop; sub my_quit { exit; }
So what I want to know is when the user clicks on the menu button, and up pops the menu saying "quit", but they haven't clicked it or let go, and the menu is still there, how do I know that? Again, I could use -postcommand to know when the menu appeared, but I would not know when it went away.

Please let me know if that clarifies the question. Thanks. I suppose I could add some hack where every option in the menu turns off some boolean that was turned on by the -postcommand option, but there should be a much more elegant solution if I could just use ismapped() on the acutal menus widget id I think. ??

Erad


In reply to Re: How to tell when menu button menu is up by Eradicatore
in thread How to tell when menu button menu is up by Eradicatore

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.