wxWidgets ContextMenu/Popup

I have a wxListCtrl and I would like to make it so that when a user right click on an item to show up a contextmenu/popup.

How can I do this with wxFormBuilder or programatically?



You need to catch the event of type wxEVT_COMMAND_LIST_ITEM_RIGHT_CLICK or wxEVT_CONTEXT_MENU (more general, thanks vadz) and then pop up a wxMenu.

An example of this can be seen in the wxListCtrl sample, which can be found in wxdir\samples\listctrl. A short snippet modified from the sample should give you the right idea:

void MyListCtrl::OnRightClick(wxListEvent& event)
    // Show popupmenu at position
    wxMenu menu(wxT("Test"));
    menu.Append(LIST_ABOUT, wxT("&About"));
    PopupMenu(&menu, event.GetPoint());

Take a look at the example in http://wiki.wxwidgets.org/WxMenu

Need Your Help

Where is the source and destination address fields in TCP header?

tcp ip ip-address packet

From what I've read, TCP sits on the layer between the application and IP, and handles setting up the packets, checking for errors, ordering etc so the application itself doesn't have to do it.

Unable to open iterator for alias in pig

hadoop apache-pig

I was doing some experiments in pig(hadoop mode).

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.