I have reused/adapted CListControl demonstration code from foo_sample to add a custom context menu to my own Dialog containing only a CListControl. Unlike the demo dialogs, my dialog can also be used as a UI Element*.
During layout editing mode my dialog should provide an "*Element Name* || Replace UI Element... || Cut UI Element | Copy UI Element | Paste UI Element" context menu, as all other UI Elements do. Instead, the custom context menu is displayed. I have determined that
void OnContextMenu(CWindow wnd, CPoint point) {
if(true) {
SetMsgHandled(false);
return;
}
...
}
results in the correct behaviour during layout editing mode. To make my custom context menu available the rest of the time, I would like to replace the "true" with some kind of expression that determines whether or not layout editing mode is currently enabled, but have been unable to find one.
*It is published using
class CListControlBookmarkDialog : public CDialogImpl<CListControlBookmarkDialog>, public ui_element_instance,
private IListControlBookmarkSource {
...
}
class clist_control_bookmark_impl : public ui_element_impl_withpopup<CListControlBookmarkDialog> {
};
static service_factory_t< clist_control_bookmark_impl > g_CListControlBookmarkDialog_factory;