Professional UI Solutions
Site Map   /  Register
 
 

Forum

Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Prof-UIS General Discussion » How to remove "Customize" popup menu Collapse All
Subject Author Date
Eugene Wineblat Aug 22, 2006 - 5:13 AM

I have MainFrame like this (From sample "languageswitcher")

class CMainFrame : public CFrameWnd
#if (!defined __EXT_MFC_NO_CUSTOMIZE)
    , public CExtCustomizeSite
#endif // (!defined __EXT_MFC_NO_CUSTOMIZE)
{
...
};

When I do RButtonClick on the prof-uis components I have popup menu which offer me to Customize everything, I want to remove this menu.

Eugene Wineblat Aug 28, 2006 - 6:52 AM

That is exactly what I need!
Thank you!

Eugene Wineblat Aug 23, 2006 - 9:09 AM

I want to hide/remove possibilty to make customization... in my case user shouldn’t see/use that possibility... As I understood this menu is formed by CExtCusomizeSite!
I need block this menu or if this menu is a part of any other menu than block this item... I hope now my problem is clear for understanding!

Technical Support Aug 24, 2006 - 8:30 AM

If you want to remove the Customize menu item only in all the Prof-UIS built-in menus, you can modify the menus before they appear on the screen and remove this command. You should handle the CExtPopupMenuWnd::g_nMsgPrepareOneMenuLevel registered windows message in the main frame window for that:

#include <Resources/Resource.h>
 
ON_REGISTERED_MESSAGE( CExtPopupMenuWnd::g_nMsgPrepareOneMenuLevel, OnExtMenuPrepare )
 
LRESULT CMainFrame::OnExtMenuPrepare( WPARAM wParam, LPARAM lParam )
{
    lParam;
CExtPopupMenuWnd::MsgPrepareMenuData_t * pData =
        reinterpret_cast< CExtPopupMenuWnd::MsgPrepareMenuData_t * > ( wParam);
    ASSERT( pData != NULL );
CExtPopupMenuWnd * pPopup = pData->m_pPopup;
    ASSERT( pPopup != NULL );
INT nPos = pPopup->ItemFindPosForCmdID( ID_EXT_CUSTOMIZE );
    if( nPos < 0 )
        return TRUE;
    VERIFY( pPopup->ItemRemove(nPos) );
    if( nPos > 0 && pPopup->ItemGetInfo(nPos-1).IsSeparator() )
       VERIFY( pPopup->ItemRemove(nPos-1) );
    pData->m_bMenuChanged = true;
    return TRUE;
}


Suhai Gyorgy Aug 24, 2006 - 1:53 AM

If you want to remove customization altogether, you should check out the article Prof-UIS Customization Subsystem, and there you can see the code needed to integrate customization into your application. Basically, if your application has customization integrated already, you need to remove all lines showed in that article, that has anything to do with customization. They are as follows:

------ begin quote from article -------

The default menu in case of the MDI application or only one menu in case of the SDI application is registered:

VERIFY(CExtCustomizeSite::MenuInfoAdd(this, _T("Default"),IDR_MAINFRAME,true));
VERIFY(CExtCustomizeSite::MenuInfoLoadAccelTable(_T("Default"),IDR_MAINFRAME));

All documents of the MDI application are registered:
VERIFY(CExtCustomizeSite::MenuInfoAdd(this, _T("Document"),IDR_DOC_TYPE, true));
VERIFY(CExtCustomizeSite::MenuInfoLoadAccelTable(_T("Document"),IDR_MAINFRAME or IDR_DOC_TYPE_ACCEL_TABLE));

The necessary settings can be made for command trees and menus. At this step, the developer can change the structure of any tree, register some text/combobox fields or color commands, modify keyboard accelerator tables, and etc. For example, to reinitialize a registered menu and set its initial state, you should do the following:
CExtCustomizeCmdTreeNode * pMenuNodeInitial = CExtCustomizeSite::MenuInfoGetByName( _T("Default") ) ->GetNode( true );
CExtCustomizeCmdTreeNode * pMenuNodeCustomized = CExtCustomizeSite::MenuInfoGetByName( _T("Default") ) ->GetNode( false );

// reset initially customized menu state:
*pMenuNodeCustomized = *pMenuNodeInitial;

Customize Site is initialized with data associated with this frame window. The necessary commands are registered in it:
if(!CExtCustomizeSite::EnableCustomization(this, __ECSF_DEFAULT))
{
     ASSERT( FALSE );
     return -1;
}
CExtCustomizeSite::CategoryUpdate( IDR_MAINFRAME ); CExtCustomizeSite::CategoryMakeAllCmdsUnique();
CExtCustomizeSite::CategoryAppendAllCommands(); CExtCustomizeSite::CategoryAppendNewMenu();

Persistent states of the customization subsystem and control bars are restored. Typically, these operations are final in the OnCreate() method of the frame window:
CExtCustomizeSite::CustomizeStateLoad(pApp->m_pszRegistryKey, pApp->m_pszProfileName, pApp->m_pszProfileName );
Finally, you should put the code for storing the UI state into the DestroyWindow() method of the main frame window:
BOOL CMainFrame::DestroyWindow() 
{
    ...
         VERIFY(CExtCustomizeSite::CustomizeStateSave(pApp->m_pszRegistryKey, pApp->m_pszProfileName, pApp->m_pszProfileName));
    ...
}

---------- end quote from article ----------

And finally one more thing, which I didn’t find in that article: In MainFrm.h, instead of
class CMainFrame : public CExtNCW < CFrameWnd >
#if (!defined __EXT_MFC_NO_CUSTOMIZE)
	, public CExtCustomizeSite
#endif // (!defined __EXT_MFC_NO_CUSTOMIZE)

your MainFrame shouldn’t be derived from CExtCustomizeSite, and should look like this:
class CMainFrame : public CExtNCW < CFrameWnd >

Hope that helps and everything is clear.

Chris

Suhai Gyorgy Aug 24, 2006 - 6:42 AM

I see from your other post that you are trying to remove Customization from LanguageSwitcher. Then you need to remove some other code as well, specific to this one sample only:

From CMainFrame class: Declaration and definition and any call of _ConfigureCustomizeSite, _ResetAllCommandTrees and _ReloadNodeFromCommandManager methods and any other calls that starts with "CExtCustomizeSite::" ( they are inside ResetLocalizedResources, OnCreate and DestroyWindow methods).

From CChildView class: Declaration, definition and MessageMap entries for OnShowCustomize and OnShowIconEditor.

Chris

Suhai Gyorgy Aug 22, 2006 - 6:16 AM

Its not completely clear what you want to do: Do you want to remove only the line about customization, or do you want the whole popup menu not to appear at all?

Actually, whichever is the question, you should check out this FAQ topic: How to modify or suppress entirely built-in pop-up menus available in Prof-UIS? That should help.

Regards:
Chris