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 |