Hello,
I'm using the HyperListCtrl widget and I ran into some problems
regarding context menus.
First I will describe how I'd expect the context menus on
HyperListCtrl to behave, so it'll be easier to know whether I'm
getting a bug or that the problem is in my expectations. (Probably I'm
misunderstanding how it's supposed to work, so please correct me.)
I expect to be able to raise a context menu in the HyperListCtrl. That
context menu may be associated with a tree item (right-clicking on a
tree item) or not (right-clicking in empty space.)
I expect to be able to raise the context menu either by:
1. Right-clicking, or
2. Pressing the menu key or Shift-F10 on Windows and Linux, or
3. Pressing the Mac shortcut on Mac. (I think it's Function+Ctrl+5,
not sure.)
(By the way, Andrea, I think you should replace the line:
elif keyCode == wx.WXK_MENU:
with this line
elif keyCode in (wx.WXK_MENU, wx.WXK_WINDOWS_MENU):
Not sure about it though, correct me if I'm wrong.)
I saw that in `customtreectrl.py` there is an event called
`EVT_TREE_ITEM_MENU`, with a description: "The context menu for the
selected item has been requested, either by a right click or by using
the menu key."
So I expect that I simply need to bind to this event in my
HyperListCtrl subclass, and in the handler I could get the item for
which the context menu was requested by using `event.GetItem()`. And I
bind `EVT_CONTEXT_MENU` to the method which raises the generic context
menu.
But it seems not to work that way. Look at this runnable sample:
http://gist.github.com/596745
Here are the problems:
* Right-clicking either on the items or in the free space doesn't do
anything. It doesn't raise neither an `EVT_TREE_ITEM_MENU` nor an
`EVT_CONTEXT_MENU`.
* Pressing the menu key / Shift-F10, either with an item selected or
not, raises `EVT_CONTEXT_MENU`.
Please tell me what I'm getting wrong.
Ram.