# Wx::Menu, get parent menu functions?

**URL:** <https://www.ruby-forum.com/t/wx-menu-get-parent-menu-functions/124857>\
**Category:** wxRuby\
**Created:** [January 3, 2008, 7:07am UTC](https://www.ruby-forum.com/t/wx-menu-get-parent-menu-functions/124857 "2008-01-03T07:07:56Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![EchoB](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/45deac/32.png) [@EchoB](https://www.ruby-forum.com/u/EchoB)\
**Post date:** [January 3, 2008, 7:07am UTC](https://www.ruby-forum.com/t/wx-menu-get-parent-menu-functions/124857/1 "2008-01-03T07:07:56Z")

</div>

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)
