[wxruby-users] Wx::Menu, get parent menu functions?

EchoB echobinary at gmail.com
Thu Jan 3 00:59:20 EST 2008


I have been looking in the API Docs for get_parent type stuff for the 
Menu's - so I can track a click path across sub-menus and have not found 
anything. Are there really no functions for that or did I just miss the 
right place to look?
If it is true then consider this below:


class MyMenu < Wx::Menu
   def initialize(mymasterclass, name = nil, id = -1, parent_menu = nil, 
title = "", style = 0)
     super(title, style)
     @name = name                  #string name
     @id = id                      #integer id
     @parent_menu = parent_menu    #MyMenu parent_menu
     if @id == -1
       @id = mymasterclass.newid() #generates newid (WxPython?)

	#for reference
   		#def newid()
		#    new_id = Wx::ID_HIGHEST + @@i_highest_counter
		#    @@i_highest_counter = @@i_highest_counter + 1
		#    return new_id
		#  end
	#=============

     end
   end

   def get_name()
     return @name
   end

   def get_id()
     return @id
   end

   def get_parent()
     return @parent_menu
   end

   def get_parent_id()
     return @parent_menu.get_id()
   end

   def has_parent()
     hasparent = false
     if @parent_menu != nil
       hasparent = true
     end
     return hasparent
   end
end

====================
Thoughts? Ideas? Alternatives? Death Threats? (heehee)


More information about the wxruby-users mailing list