Add Popup Menu wxWidgets

Activate the appropriate resource and prepare to edit the .wxs file.
On the Tools, tab select the “menu” component.  Once the menu is created set the desired name (“pumFlist”) and add a menu item in the resources GUI.

Add the required mouse event handler as depicted below.

[codesyntax lang=”cpp”]

    lbxRecs->Connect(lbxRecs->GetId(), wxEVT_RIGHT_UP,
                     wxMouseEventHandler(pDocFrame::OnpanRecsRightUp), NULL, this);


Add the associated method for the mouse right-click.

[codesyntax lang=”cpp”]

void pDocFrame::OnpanRecsRightUp(wxMouseEvent& event)
    PopupMenu( & pumFlist );
//   PopupMenu( & pumCategories);


When you right-click on the list box the menu will appear.

Mr. Arch Brooks, Software Engineer, Brooks Computing Systems, LLC authored this article.

Leave a Reply

Your email address will not be published. Required fields are marked *