in reply to Is Tk::Text-widget PopUp-menu onscreen?

It was simpler than I thought above. This does it, but there still is a need to detect cascading submenus.
#!/usr/bin/perl use warnings; use strict; use Tk; my $mw = MainWindow->new(); my $Text = $mw->Text()->pack; my $TextMenu = $Text->menu(); $TextMenu->bind("<Enter>",sub {print "1\n" }); $TextMenu->bind("<Leave>",sub {print "0\n" }); MainLoop;

I'm not really a human, but I play one on earth. flash japh

Replies are listed 'Best First'.
Re^2: Is Tk::Text-widget PopUp-menu onscreen?
by ldln (Pilgrim) on Aug 14, 2005 at 14:05 UTC
    Hm, strange cos that was something I tried before posting here.

    Tried with different event-bindings on the Menu-widget. But Since <Motion>, <Enter> etc events didn't work (Win32/Tk800.024), I assumed that Menu-widgets didn't support bindings.. but the <Leave>-event acutally works (the event-sub is, for whatever reason, even called TWICE when the event triggers, hehe).

    Together with using the "-postcommand" option instead of the <Enter> event, I can achieve what I want.

    Thanks zentara!