我在功能区的同一个面板上有2个CMFCRibbonComboBox -例如:
CMFCRibbonComboBox *individualComputers =
new CMFCRibbonComboBox(-1,FALSE, 100, "Individual Computers", -1);
individualComputers->AddItem("Computer 1");
individualComputers->AddItem("Computer 2");
individualComputers->AddItem("Computer 3");
individualComputers->SelectItem(0);
CMFCRibbonComboBox * groupNames =
new CMFCRibbonComboBox (-1, FALSE, 100, "Computer Group Names", -1);
groupNames->AddItem("GROUP 1");
groupNames->AddItem("GROUP 2");
groupNames->AddItem("GROUP 3");
groupNames->SelectItem(0);
CMFCRibbonPanel* pComputerGroups = cComputerGroups->AddPanel("All Groups");
//cComputerGroups is a Category
pComputerGroups->Add(individualComputers);
pComputerGroups->Add(groupNames);问题是,当我从UI(USer界面)中选择groupNames comboBox中的"Group 1“时,甚至从组individualComputers中选择了"Computer 1”。如何使每个combobox组相互独立?谢谢。
发布于 2012-04-19 03:37:00
我怀疑您不想将您的组合框添加到自己的individualComputers->Add(individualComputers);中,也许应该是pComputerGroups->Add(individualComputers);
否则,您的bug可能在命令或updateUI处理代码中的其他位置,而未显示。这很可能是因为您使用相同的ID -1来标识这两个组合框。
此外,正如您为groupNames所示,CMFCRibbonComboBox没有重载构造函数,它需要额外的两个参数。
请在以后展示遵循SSCCE的实际代码
编辑:将之前未解决的评论设置为粗体,因为它很可能是您的剩余问题。考虑使用const UINT CB_COMP_ID = 1;和const UINT CB_GROUP_ID = 2;,然后可以在消息映射中使用CB_COMP_ID或CB_GROUP_ID分别引用每个组合框。
https://stackoverflow.com/questions/10216416
复制相似问题