2016-04-21 40 views

回答

2

您將不得不迭代AOT並將字符串與菜單項進行比較。 https://blogs.msdn.microsoft.com/dsiebold/2010/08/13/use-x-to-loop-through-the-aot/

#AOT 

//These are the macros for the paths found in #AOT. 
//Don't use macros in practice. It's a bad habit. 
//#define.MenuItemsDisplayPath('\\Menu Items\\Display') 
//#define.MenuItemsOutputPath('\\Menu Items\\Output') 
//#define.MenuItemsActionPath('\\Menu Items\\Action') 

TreeNode menuItemParentNode; 

//str menuItemName = "derp";//output: "derp is not a valid menu item" 
str menuItemName = "ActivitiesMain";//output: "ActivitiesMain is a valid menu item" 

//Only checking display here, you would need another level of 
//nodes to do output and actions. 
menuItemParentNode = TreeNode::findNode(#MenuItemsDisplayPath); 

if (menuItemParentNode.AOTfindChild(menuItemName)) 
    info(strFmt("%1 is a valid menu item", menuItemName)); 
else 
    info(strFmt("%1 is not a valid menu item", menuItemName)); 

此代碼是從這裏提供的示例適於