I've tried EVT_MENU($this, 123, sub{warn 2} ); EVT_MENU($this, 123, undef ); which doesn't work.
Is it even possible? (i suspect it's not, but I can't be sure)
If i don't get any replies, I will ask on the wxPerl mailing list.
Heere's test code
#!/usr/bin/perl use Wx; # every program must have a Wx::App-derive class package MyApp; use strict; use vars qw(@ISA); @ISA=qw(Wx::App); use Wx qw[ :everything ]; use Wx::Event qw[ EVT_MENU ]; # this is called automatically on object creation sub OnInit { my( $this ) = @_; # create new MyFrame my( $frame ) = MyFrame->new( "Accelerator Test", Wx::Point->new( 50, 50 ), Wx::Size->new( 450, 350 ) ); my $menuBar = new Wx::MenuBar(); my $menu = new Wx::Menu(); $menu->Append( 123, "&About...\tCtrl-A", "Show about dialog." ); EVT_MENU($frame, 123, sub { warn "PUCK"; print Dumper\@_; EVT_MENU($frame, 123, undef); EVT_MENU($frame, 123, sub{ die "DIFFERENT" }); } ); $menuBar->Append($menu, "Info"); $frame->SetMenuBar( $menuBar ); EVT_MENU($frame, 321, sub { warn "I'm FAKING IT, I'm FAKING IT GOOD +@_" } ); my $ACCL = new Wx::AcceleratorTable( [ wxACCEL_CTRL, 'C', ### NEEDS TO BE CAPITAL ( UNDOCUMENTED ) 123, ], [ wxACCEL_CTRL, 'Q', 321, ], ); $frame->SetAcceleratorTable($ACCL); # set it as top window (so the app will automatically close when # the last top window is closed) $this->SetTopWindow( $frame ); # show the frame $frame->Show( 1 ); 1; } package MyFrame; use strict; use vars qw(@ISA); @ISA=qw(Wx::Frame); use Wx qw(wxBITMAP_TYPE_BMP wxMENU_TEAROFF); # Parameters: title, position, size sub new { my( $class ) = shift; my( $this ) = $class->SUPER::new( undef, -1, $_[0], $_[1], $_[2] ); $this; } package main; # create an instance of the Wx::App-derived class my( $app ) = MyApp->new(); # start processing events $app->MainLoop();
____________________________________________________
** The Third rule of perl club is a statement of fact: pod is sexy.
In reply to How do i unbind a function bound by EVT_MENU ? by PodMaster
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |