wxTreeEvent event; wxPoint pos = event.GetPoint();
void MyFrame::OnTreeItemRightClick(wxTreeEvent& event) { wxPoint pos = event.GetPoint(); wxMenu menu; menu.Append(wxID_DELETE, "Delete"); PopupMenu(&menu, pos); }In this example, the GetPoint function is used to retrieve the current mouse position when a tree item is right-clicked. The mouse position is then used to display a popup menu at the correct location.