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 » CategoryMakeFromTreeN Collapse All
Subject Author Date
Stephan Finkler Jun 29, 2005 - 7:53 AM

Hi,

I tried to use the CExtCustomizeSite::CategoryMakeFromTreeN function
but I get always an assert in

int CExtCustomizeSite::CategoryMakeFromTree(
    CExtCustomizeCmdTreeNode * pNodeCategoryRoot,
    __EXT_MFC_SAFE_LPCTSTR strCategoryName // = NULL
    )
{
    ASSERT_VALID( pNodeCategoryRoot );
    ASSERT_KINDOF( CExtCustomizeCmdTreeNode, pNodeCategoryRoot );
CExtSafeString _strCategoryName;
    if( strCategoryName != NULL )
        _strCategoryName = strCategoryName;
    else
        _strCategoryName = pNodeCategoryRoot->GetTextUser();
    ASSERT( ! _strCategoryName.IsEmpty() );


because pNodeCategoryRoot->GetTextUser(); returns an empty string

here is my code:

for( int nMenuInfoIdx = 0; nMenuInfoIdx < CExtCustomizeSite::MenuInfoGetCount(); nMenuInfoIdx++ )
{
CExtCustomizeSite::CCmdMenuInfo *pCmdMenuInfo = CExtCustomizeSite::MenuInfoGetAt(nMenuInfoIdx) ;
ASSERT( pCmdMenuInfo != NULL );
if(pCmdMenuInfo != NULL) {

CExtCustomizeCmdTreeNode *pMenuRootNode = NULL;
pMenuRootNode = pCmdMenuInfo->GetNode(true);
ASSERT_VALID( pMenuRootNode );
if(pMenuRootNode != NULL) {
CExtCustomizeSite::CategoryMakeFromTreeN(pMenuRootNode);
}
}
}


How can I update the categories by a command tree node?


Technical Support Jun 29, 2005 - 12:37 PM

Thank you for the interesting question. Each command tree node has three text properties: text in menu, text in toolbar and user-defined text. The user-defined text is empty in most cases. It is empty for command tree nodes created from menu resources. The CExtCustomizeSite::CategoryMakeFromTreeN() method traverses nodes that are child to a particular node and uses creates command categories from them. The CExtCustomizeSite::CategoryMakeFromTreeN() method assumes that each child node used for creating its category has a non-empty user-defined text property because it is used as a command category name. That is why you encountered the assertion. You can simply assign user defined text (using menu text) menu text for all the child nodes by calling the CExtCustomizeCmdTreeNode::SetTextUser() method before you call CExtCustomizeSite::CategoryMakeFromTreeN().