Example #1
0
/*----------------------------------------------------------------------------------------------
	Process notifications from the user.
----------------------------------------------------------------------------------------------*/
bool FmtGenDlg::OnNotifyChild(int ctidFrom, NMHDR * pnmh, long & lnRet)
{
	AssertPtr(pnmh);

	switch (pnmh->code)
	{
	case EN_KILLFOCUS: // Edit control modified.
		// Suppress updating the style from the control when we are trying to update the
		// control from the style.
		if (m_fSuppressLossOfFocus)
			break;

		if (ctidFrom == kctidFgEdName)
		{
			if (!m_pafsd->StyleIsSelected())
				return true;
			StyleInfo & styiSelected = m_pafsd->SelectedStyle();
			StrApp strOldName(styiSelected.m_stuName); // Save old name.
			StrApp strNewName;
			StrUni stuName;

			strNewName = GetName();

			// If the name has not changed, there is nothing to do.
			if (strNewName.Equals(strOldName))
				return true;

			stuName.Assign(strNewName);

			// If the style cannot be named stuName, put the old name back into the control.
			if (!m_pafsd->SetName(styiSelected, stuName))
			{
				::SetDlgItemText(m_hwnd, kctidFgEdName, strOldName.Chars());
				return true;
			}
			// Otherwise update the comboboxes for BasedOn and Next. Also update the edit box
			// to handle stripping of leading/trailing blanks.
			else
			{
				::SetDlgItemText(m_hwnd, kctidFgEdName, strNewName.Chars());
				UpdateComboboxes(strOldName, strNewName);
			}
		}
		return true;

	case CBN_SELCHANGE: // Combo box item changed.
		return OnComboChange(pnmh, lnRet);

	default:
		break;
	}

	return AfWnd::OnNotifyChild(ctidFrom, pnmh, lnRet);
}
Example #2
0
void 
BlobMgmt::OnDlgProcWmCommand(WPARAM wparam, LPARAM lparam)
{
    switch(LOWORD(wparam))
	{
	case IDCANCEL:
		
		if(ProcessCancel() == wyTrue)
			VERIFY(yog_enddialog(m_hwnddlg, 0));
		break;
    
	case IDOK:
		if(ProcessOK() == wyTrue)
		    VERIFY(yog_enddialog(m_hwnddlg, 1));
        else
            VERIFY(yog_enddialog(m_hwnddlg, 0));
		break;

	case IDC_SAVETOFILE:
		SaveToFile();
		break;

	case IDC_IMPORT:
		OpenFromFile();
		break;

	case IDC_SETNULL:
		{
			// if a user has selected it then we disable evrything
			// otherwise enable everything
			if(Button_GetCheck((HWND)lparam)== BST_CHECKED)
				DisableAll(wyTrue);
			else 
				DisableAll(wyFalse);
		}
	break;	
	case IDC_COMBO:
		{
			if((HIWORD(wparam))== CBN_SELENDOK)
				OnComboChange();
			break;
		}
	}
    return;
}