I was trying to delete menu items in a submenu, the code worked fine on
Windows, but failed on Mac.
I modified the sample bigdemo/wxMenu.rbw,
def menu_101(event) @log.write_text(“Welcome to Mercury”)
# New here, change submenu to @submenu in initialize() @submenu.get_menu_items.each do |menu_item| @submenu.delete(menu_item)
end
end
Error:
wxMenu.rbw:140:in `delete’: Wrong arguments for overloaded method
‘wxMenu.Delete’. (ArgumentError)
Possible C/C++ prototypes are:
void wxMenu.Delete(int id)
void wxMenu.Delete(wxMenuItem *item)
Error:
wxMenu.rbw:140:in `delete’: Wrong arguments for overloaded method
‘wxMenu.Delete’. (ArgumentError)
Possible C/C++ prototypes are:
void wxMenu.Delete(int id)
void wxMenu.Delete(wxMenuItem *item)
Thanks for the report and sample code. I tried this out with 1.9.9 and I
get an error (although a slightly different one).
I tried it with SVN HEAD (with ruby 1.8.6 and 1.9.1) and it works
correctly, no error is raised. I believe it may have been fixed by a
change I applied following this previous thread, so that MenuItems are
correctly preserved from GC: