- wxTreeEvent event( wxEVT_COMMAND_TREE_ITEM_MENU, GetId() );
- event.m_item = m_current;
- event.SetEventObject( this );
- GetEventHandler()->ProcessEvent( event );
+ // Use the item's bounding rectangle to determine position for the event
+ wxRect ItemRect;
+ GetBoundingRect(m_current, ItemRect, true);
+
+ wxTreeEvent eventMenu( wxEVT_COMMAND_TREE_ITEM_MENU, GetId() );
+ eventMenu.m_item = m_current;
+ // Use the left edge, vertical middle
+ eventMenu.m_pointDrag = wxPoint(ItemRect.GetX(),
+ ItemRect.GetY() + ItemRect.GetHeight() / 2);
+ eventMenu.SetEventObject( this );
+ GetEventHandler()->ProcessEvent( eventMenu );