本文介绍了这应该做什么:CMFCToolBar :: IsLastCommandFromButton?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不确定这种方法的用途和用途是什么。



MSDN:确定最近执行的命令是否是从指定的工具栏按钮。



我唯一的参考是来自VisualStudio MSDN示例:



当用户在工具栏中的组合框中选择一个值时调用方法。

I''m not certain what this method is used for and in what circumstances.

MSDN : "Determines whether the most recently executed command was sent from the specified toolbar button."

The only reference I have is from the VisualStudio MSDN sample :

The method is called when the user select a value in a combobox in a toolbar.

  ON_COMMAND(ID_DUMMY_SELECT_ACTIVE_CONFIGURATION, OnDummySelectActiveConfiguration)
  ON_CBN_SELENDOK(ID_DUMMY_SELECT_ACTIVE_CONFIGURATION, OnDummySelectActiveConfiguration)

//...
void CVisualStudioDemoDoc::OnDummySelectActiveConfiguration()
{
  CMFCToolBarComboBoxButton* pSrcCombo = NULL;

  CObList listButtons;
  if (CMFCToolBar::GetCommandButtons(ID_DUMMY_SELECT_ACTIVE_CONFIGURATION, listButtons) > 0)
  {
    for (POSITION posCombo = listButtons.GetHeadPosition(); pSrcCombo == NULL && posCombo != NULL;)
    {
      CMFCToolBarComboBoxButton* pCombo = DYNAMIC_DOWNCAST(CMFCToolBarComboBoxButton, listButtons.GetNext(posCombo));

      if (pCombo != NULL && CMFCToolBar::IsLastCommandFromButton(pCombo))
      {
        pSrcCombo = pCombo;
      }
    }
  }

  if (pSrcCombo != NULL)
  {
    ASSERT_VALID(pSrcCombo);
    LPCTSTR lpszSelItem = pSrcCombo->GetItem();
    CString strSelItem = (lpszSelItem == NULL) ? _T("") : lpszSelItem;

    AfxMessageBox(strSelItem);
  }
  else
  {
    AfxMessageBox(_T("Show \"Set Active Configuration\" dialog...."));
  }
}





任何线索/提示?



谢谢。



最大。



Any clue/hints ?

Thanks.

Max.

推荐答案


这篇关于这应该做什么:CMFCToolBar :: IsLastCommandFromButton?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-01 18:13