Link to home
Start Free TrialLog in
Avatar of mashey
masheyFlag for United States of America

asked on

Context Menu on CCheckBoxList Items only when an item is selected

I have a Main UI (MP_UI),  which comprises of various controls. One of the controls is a ListBox Control.
The items inside are CCheckListBox based items.

What I am trying to do is add a context menu when the user selects  a check box item and right clicks. Right Click function should only be part of the listbox control (IDC_HOST_LIST)  and only when an item is selected.

I have a class CCheckListBoxMP, which is a derived class from CCheckListBox. The member functions in CCheckListBoxMP allows the user to do operations like add an item, delete an item, rename, update etc.

I added a WM_CONTEXTMENU to CCheckListBoxMP.cpp and implemented the function CCheckListBoxMP::OnContextMenu(CWnd, CPoint).

However I cannot seem to access the popup menu (which is partt of the MainUI.rc) in my CCheckListBoxMP. How will I do it.

Also how do I invoke right click on MainUI such that the OnContextMenu is correctly called and displayed.
ASKER CERTIFIED SOLUTION
Avatar of mrwad99
mrwad99
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
The code I posted demonstrates how to achieve what the questioner is asking, so I believe I should have the points, please :)
Avatar of Dirk Haest
This question has been classified as abandoned and is being closed as part of the Cleanup Program.  See my comment at the end of the question for more details.