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 Tech Support » Regarding g_CmdManager->CmdSetup. Collapse All
Subject Author Date
Matthew Fraser Apr 23, 2007 - 12:57 AM

Hi!!

If I can’t use such as the following methods,
I realized that the following codes work fine.
because I put some source codes generating dynamic popup menu items (started with 100 as below).
and I don’t know how many submenu items there will be so I can’t fix something stored in the registry.

g_CmdManager->SetBasicCommands
ProfileBarStateLoad

-------------------------------------------------------------------------------------------------

// This works fine instead of the two lines above.
// This is only for a dynamic popup menu construction.

CExtCmdItem temp;
temp.m_nCmdID = 100;
g_CmdManager->CmdSetup(__PROF_UIS_PROJECT_CMD_PROFILE_NAME, temp);

-------------------------------------------------------------------------------------------------

Is there anything I need to consider if I want to use some codes above ?
or is there an alternative way ?

Many thanks in advance again.

Technical Support Apr 23, 2007 - 9:58 AM

As you know in Win32 toolbars, menus and dialog controls are used 16-bit unsigned item identifiers (0...65535). In Prof-UIS, command identifiers in the range of 29000 to 31000 are reserved for internal commands, built-in commands and dialog control identifiers. Zero is commonly used as the separator identifier. The ushort(-1) is commonly used as a popup submenu item identifier. Some of identifiers are allocated by Visual Studio resource editor and you can see these identifiers in resource.h file of your project. All the other identifiers can be used in your dynamic menus. The CExtPopupMenuWnd::ItemInsert() method inserts menu items which have references to command descriptions in the command manager. The CExtPopupMenuWnd::ItemInsertCommand() method inserts menu items which have NO references to command descriptions in the command manager and NOT updated with MFC’s command updating mechanism. The last method is convenient for constructing dynamic popup menus. You can also let the command manager to allocate the command identifiers automatically by invoking g_CmdManager()->CmdAllocPtr(0).