# Creating corrent menuitems with xrcise

**URL:** <https://www.ruby-forum.com/t/creating-corrent-menuitems-with-xrcise/177861>\
**Category:** wxRuby\
**Created:** [October 25, 2009, 7:44pm UTC](https://www.ruby-forum.com/t/creating-corrent-menuitems-with-xrcise/177861 "2009-10-25T19:44:27Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![pixellover](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/ee59a6/32.png) [@pixellover](https://www.ruby-forum.com/u/pixellover)\
**Post date:** [October 25, 2009, 7:44pm UTC](https://www.ruby-forum.com/t/creating-corrent-menuitems-with-xrcise/177861/1 "2009-10-25T19:44:27Z")

</div>

Hi List,

actually I’m trying to generate my UI with wxFormBuilder. But I  
haven’t managed to create correct plattform-independent Quit- and  
About-Menuitem with the correct IDs (Wx::ID\_EXIT, Wx::ID\_ABOUT). Can  
anyone tell me how to do this?

Everything I tried so far leads to not working menu items or false  
menu items in i.e. Mac OS.

Regards,  
Timo

---

<div class="post-metadata">

**Author:** ![pixellover](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/ee59a6/32.png) [@pixellover](https://www.ruby-forum.com/u/pixellover)\
**Post date:** [October 27, 2009, 1:45pm UTC](https://www.ruby-forum.com/t/creating-corrent-menuitems-with-xrcise/177861/2 "2009-10-27T13:45:09Z")

</div>

Timo S. wrote:

> actually I’m trying to generate my UI with wxFormBuilder. But I  
> haven’t managed to create correct plattform-independent Quit- and  
> About-Menuitem with the correct IDs (Wx::ID\_EXIT, Wx::ID\_ABOUT). Can  
> anyone tell me how to do this?

I haven’t used wxFormBuilder. But looking at the screenshots, there is a  
box in a panel on the right-hand side called “Object Properties”. At the  
top of the yellow tinted section in this list of properties, there is an  
entry called “id” which I guess has the default value “wxID\_ANY”. To use  
one of the standard ids, change this to wxID\_EXIT, wxID\_ABOUT.

Generally to map from C++ constant and class names to Ruby, replace the  
preceding wx (lower case) with Wx:: (module name).

C++ → Ruby  
wxWindow → Wx::Window  
wxID\_EXIT → Wx::ID\_EXIT

a

---

<div class="post-metadata">

**Author:** ![pixellover](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/ee59a6/32.png) [@pixellover](https://www.ruby-forum.com/u/pixellover)\
**Post date:** [October 27, 2009, 9:03pm UTC](https://www.ruby-forum.com/t/creating-corrent-menuitems-with-xrcise/177861/3 "2009-10-27T21:03:41Z")

</div>

Hey guys,

Sorry, been busy with RL. Actually, you just need to define wxID\_EXIT,  
and  
wxID\_ABOUT in the wxFormBuilder. On the Ruby side, you need to use  
Wx::ID\_EXIT and Wx::ID\_ABOUT to catch it. This is cause of the naming  
conventions, and how Ruby doesn’t allow constants to be formed with a  
lowercase first letter. EG: All constants, classes, and modules need to  
start their first character as an Uppercase letter. Ruby will throw a  
tissy  
fit when you don’t do this.

Again, sorry for the late reply.
