Skip to main content
Topic: Checking whether Layout Editing Mode is enabled to supress a custom context menu (Read 97 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Checking whether Layout Editing Mode is enabled to supress a custom context menu

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
Code: [Select]
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
Code: [Select]
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;

Re: Checking whether Layout Editing Mode is enabled to supress a custom context menu

Reply #1
Look at foo_sample/ui_element.cpp. Look for m_callback and how it's initialised with the constructor. Once you've done that, you can use m_callback->is_edit_mode_enabled()

Re: Checking whether Layout Editing Mode is enabled to supress a custom context menu

Reply #2
Thanks a lot, that's exactly what I was looking for.

 
SimplePortal 1.0.0 RC1 © 2008-2019