Link to home
Start Free TrialLog in
Avatar of sgraves66
sgraves66

asked on

Context menu help

I have a CListCtrl-derived class which instantiates a context menu. The ListCtrl object is located within a form view. How do I allow the view class to process the menu selection rather than the CListCtrl-derived class? ON_COMMAND(ID_PROP_TEST, OnPropTest) handled by view class.
Avatar of Zoppo
Zoppo
Flag of Germany image

Hi sgraves66,

do you use CMenu::TrackPopupMenu in the derived list class's OnContextMenu to
display the menu? If so simply pass a pointer to the view instead of the pointer
to the list as 4th parameter...

hope that helps,

ZOPPO
Avatar of sgraves66
sgraves66

ASKER

The handle arg sunk in right after I posted this -- Didn't think about it the first go round :)

My next task is to disable menu items based upon the mouse cursor in relation to the items (all in report view). I've added remove / remove selected / remove all to the popup menu. I just need to disable "remove" if no items are present below the mouse cursor (in whitespace). How can I reference the popup menu from the view class in order to make these changes?
Inc. points for 2 question...
ASKER CERTIFIED SOLUTION
Avatar of Zoppo
Zoppo
Flag of Germany 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
Hello,

You can repost a message (the same perhaps) to the View class, and also add a message handler there...

Tim Musschoot