【问题标题】:CMFCRibbonBar: GetEditText() doesn't return the actual edit box text of a CMFCRibbonComboBox unless window loses the focusCMFCRibbonBar:GetEditText() 不会返回 CMFCRibbonComboBox 的实际编辑框文本,除非窗口失去焦点
【发布时间】: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


    【解决方案1】:

    目前,在调用GetEditText() 之前,我已经将SetFocus() 连接到MDI 子窗口。但这肯定不是最好的解决方法!

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-10-03
      • 1970-01-01
      相关资源
      最近更新 更多