# Missing evt\_tree\_item\_menu method for TreeCtrl?

**URL:** <https://www.ruby-forum.com/t/missing-evt-tree-item-menu-method-for-treectrl/130340>\
**Category:** wxRuby\
**Created:** [February 27, 2008, 2:39pm UTC](https://www.ruby-forum.com/t/missing-evt-tree-item-menu-method-for-treectrl/130340 "2008-02-27T14:39:04Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![chauk-mean](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/d07c76/32.png) [@chauk-mean](https://www.ruby-forum.com/u/chauk-mean)\
**Post date:** [February 27, 2008, 2:39pm UTC](https://www.ruby-forum.com/t/missing-evt-tree-item-menu-method-for-treectrl/130340/1 "2008-02-27T14:39:04Z")

</div>

Hi,

The documentation mentions the evt\_tree\_item\_menu method for TreeCtrl  
but it seems that this method is not defined (wxRuby 1.9.4 on  
Windows).

As a workaround, I’m currently using evt\_tree\_item\_right\_click.

Cheers.

Chauk-Mean.

---

<div class="post-metadata">

**Author:** ![chauk-mean](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/d07c76/32.png) [@chauk-mean](https://www.ruby-forum.com/u/chauk-mean)\
**Post date:** [February 27, 2008, 3:42pm UTC](https://www.ruby-forum.com/t/missing-evt-tree-item-menu-method-for-treectrl/130340/2 "2008-02-27T15:42:20Z")

</div>

Hi

Chauk-Mean P wrote:

> The documentation mentions the evt\_tree\_item\_menu method for TreeCtrl  
> but it seems that this method is not defined (wxRuby 1.9.4 on  
> Windows).  
> Thanks for spotting that. We’ll fix in SVN, but in the meantime if you  
> wanted to use the right event handler you could add the following at the  
> top of your script after require ‘wx’.

Wx::EvtHandler.register\_class(Wx::TreeEvent,  
Wx::EVT\_COMMAND\_TREE\_ITEM\_MENU,  
‘evt\_tree\_item\_menu’,  
1)

alex

---

<div class="post-metadata">

**Author:** ![chauk-mean](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/d07c76/32.png) [@chauk-mean](https://www.ruby-forum.com/u/chauk-mean)\
**Post date:** [February 27, 2008, 5:24pm UTC](https://www.ruby-forum.com/t/missing-evt-tree-item-menu-method-for-treectrl/130340/3 "2008-02-27T17:24:12Z")

</div>

Hi Alex,

2008/2/27, Alex F. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

> in the meantime if you wanted to use the right event handler  
> you could add the following at the  
> top of your script after require ‘wx’.
> 
> Wx::EvtHandler.register\_class(Wx::TreeEvent,  
> Wx::EVT\_COMMAND\_TREE\_ITEM\_MENU,  
> ‘evt\_tree\_item\_menu’, 1)

Thanks. This is much better than my basic workaround.  
Now the contextual menu key on my keyboard works also.

Chauk-Mean.
