From: Mattia B. <mb...@ds...> - 2002-07-29 20:14:57
|
> I'm having a few difficulties with menus. I'm trying to implement a > file history. How do you change a menu? > I thought you would delete it and then append it, or use SetLabel. > > Anyway, neither $mfile->Delete(id), Destroy, Remove or SetLabel have > any effect. Does anybody have a sample? > wxPerl does not complain, but nothing happens. I tried UpdateUI(), but > that changes nothing. The C++ menu sample uses Destroy(). This works for me (added to minimal sample). $mfile->Append( 123, "Append" ); $mfile->Append( 124, "Remove" ); EVT_MENU( $this, 123, sub { $mhelp->Append( 1, "Dummy" ); } ); EVT_MENU( $this, 124, sub { #$mhelp->Destroy(($mhelp->GetMenuItems)[-1]); # this one works too $mhelp->Destroy( 1 ); } ); > 2) Is Menu Range implemented? > I tried: > EVT_MENU_RANGE($this,$main::ID_FILEHISTORY1, $main::ID_FILEHISTORY5, > \&OnFileHistory); > > and get: > Error while autoloading 'Wx::wxEVT_COMMAND_MENU_RANGE' at > J:/Perl/site/lib/Wx/Event.pm line 54 Oops, in Wx/Event.pm, replace wxEVT_COMMAND_MENU_RANGE with wxEVT_COMMAND_MENU_SELECTED. Regards Mattia |