Noob question for wxMenu.get_menu_items()

How do I iterate through the pseudo-template list class containing
wxMenuItem pointers.
Am still a bit of a Ruby/wxRuby noob.
Currently have this:

pp mymenu.get_menu_items()

which prints:
#SWIG::TYPE_p_wxMenuItemList:0x4634fa8

However when I try to do:
mymenu.get_menu_items().each {|key| …} it tells me there is no each
method for this class (SWIG::TYPE_p_wxMenuItemList)

EchoB wrote:

How do I iterate through the pseudo-template list class containing
wxMenuItem pointers.
Am still a bit of a Ruby/wxRuby noob.
Currently have this:

pp mymenu.get_menu_items()

which prints:
#SWIG::TYPE_p_wxMenuItemList:0x4634fa8
Ooops, it’s a bug. Thanks for the report. In the meantime you should be
able to do something like the following to iterate over each item inside
a Menu

class MyMenu < Wx::Menu
  def each
    (0...menu_item_count).each do | i |
      yield find_item_by_position(i)
    end
  end
end

cheers
alex

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs