Ejemplo n.º 1
0
void CMainFrame::OnAskQuestion()
{
	CMFCToolBarComboBoxButton* pHelpCombo = m_wndMenuBar.GetHelpCombobox ();
	if (pHelpCombo == NULL)
	{
		return;
	}

	CString strQuestion = pHelpCombo->GetText ();
	strQuestion.TrimLeft ();
	strQuestion.TrimRight ();

	if (strQuestion.IsEmpty ())
	{
		return;
	}

	pHelpCombo->AddItem (strQuestion);

	CString str;
	str.Format (_T("The question is: %s"), (LPCTSTR)strQuestion);

	MessageBox (str);

	SetFocus ();
}
Ejemplo n.º 2
0
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...."));
	}
}
void CResultDataWnd::OnToolbarCommand(UINT ID)
{
	int index = m_wndToolBar.CommandToIndex(ID);
	CMFCToolBarComboBoxButton* pCtrl = (CMFCToolBarComboBoxButton*)m_wndToolBar.GetButton(index); 
	ASSERT(pCtrl);

	int sel = pCtrl->GetCurSel(); 
	m_grid.SetStatType(sel);
}
Ejemplo n.º 4
0
void CMainFrame::OnDropDown()
{
	CString FileName;
	CMFCToolBarComboBoxButton* pComboButton = (CMFCToolBarComboBoxButton*) m_wndLoadFileBar.GetButton(1);
	CComboBox* pLoadFile = pComboButton->GetComboBox();

	pLoadFile->GetWindowText(FileName);
	pLoadFile->ResetContent();
	pLoadFile->Dir(DDL_READWRITE,"*.*");
	pLoadFile->SetWindowText(FileName);
}
Ejemplo n.º 5
0
void CMainFrame::OnSelChange()
{
	CString FileName;
	CMFCToolBarComboBoxButton* pComboButton = (CMFCToolBarComboBoxButton*) m_wndLoadFileBar.GetButton(1);
	CComboBox* pLoadFile = pComboButton->GetComboBox();

	if(CB_ERR!=pLoadFile->GetCurSel())
	{
		pLoadFile->GetLBText(pLoadFile->GetCurSel(),FileName);
		AfxGetApp()->OpenDocumentFile(FileName);
	}
}
Ejemplo n.º 6
0
void CTextPropertyToolBar::OnFontNameChanged()
{
	CMFCToolBarComboBoxButton *pButton = (CMFCToolBarComboBoxButton*)this->GetButton(GetButtonIndex(ID_FONTCOMBO_TEXT));
	CString name = pButton->GetItem(pButton->GetCurSel());
	m_pObserver->PropertyChanged(TextPropertyBuilder::CreateTextProperty(PropertyEnum_FontName, name));
}
Ejemplo n.º 7
0
void CTextPropertyToolBar::OnFontSizeChanged()
{
	CMFCToolBarComboBoxButton *pButton = (CMFCToolBarComboBoxButton*)this->GetButton(GetButtonIndex(ID_SIZECOMBO_TEXT));
	CString size = pButton->GetItem(pButton->GetCurSel());
	m_pObserver->PropertyChanged(TextPropertyBuilder::CreateTextProperty<int>(PropertyEnum_FontSize, std::stoi(size.GetBuffer())));
}