【发布时间】:2014-06-22 23:06:57
【问题描述】:
我有一个带有“查找”面板的 VS2008 项目,该面板包含一个可编辑的组合框以及一个前进和后退搜索按钮。当我按下搜索按钮时,GetEditText() 返回一个过时的值。
CMainFrame *pFrame = static_cast<CMainFrame*>(GetTopLevelFrame());
CMFCRibbonBar* pRibbon = pFrame->GetRibbonBar();
ASSERT_VALID(pRibbon);
CMFCRibbonComboBox* pFindCombobox =
DYNAMIC_DOWNCAST(CMFCRibbonComboBox, pRibbon->FindByID(ID_MY_FIND_COMBOBOX));
// this returns the last value before the combo box edit field got the focus:
pFindCombobox->GetEditText();
是否有一种标准方法可以将编辑字段的内容“刷新”到GetEditText() 访问的值缓冲区?
我注意到在 VS2010 中 CMFCRibbonPanel 类中有一个 SetFocused() 成员,可用于从组合框中窃取焦点并可能强制 GetEditText() 返回正确的值,但它在VS2008.
我目前没有如何处理这个问题的想法。希望有人有线索。
【问题讨论】:
标签: mfc mfc-feature-pack cmfcribbonpanel