LRESULT CPropertiesWnd::OnUIPropChanged(WPARAM wp, LPARAM lp)
{
	CMFCPropertyGridProperty* pProp = (CMFCPropertyGridProperty *)lp;
	SetUIValue(pProp, pProp->GetData());

	return TRUE;
}
Example #2
0
LRESULT CDialogUIAttribEdit::OnUIPropChanged(WPARAM wp, LPARAM lp)
{
	CMFCPropertyGridProperty* pProp = (CMFCPropertyGridProperty *)lp;
	SetUIValue(pProp, pProp->GetData());

	return TRUE;
}
void CWorkspaceBar::SetPropState ()
{
	for (int i = 0; i < m_wndPropList.GetPropertyCount (); i++)
	{
		CMFCPropertyGridProperty* pProp = m_wndPropList.GetProperty (i);
		ASSERT_VALID (pProp);

		if ((int) pProp->GetData () != idShowMDITabs)
		{
			pProp->Enable (theApp.m_Options.m_nMDITabsType != CMDITabOptions::None);
		}
		
		if ((int) pProp->GetData () == idMaximizeMDIChild)
		{
			pProp->Enable (theApp.m_Options.m_nMDITabsType == CMDITabOptions::MDITabsStandard);
		}
	}

	if (m_wndPropList.GetSafeHwnd () != NULL)
	{
		m_wndPropList.RedrawWindow ();
	}
}
void CDlgAddCards::OnClickedBtnOK()
{
	// TODO: 在此添加控件通知处理程序代码	
	//
	int nCnt = m_proCard.GetPropertyCount();
	for( int i = 0; i < nCnt; i++)
	{
		CMFCPropertyGridProperty* pProp = m_proCard.GetProperty(i);
		if(!pProp || FALSE == pProp->IsEnabled())
			continue;
		CCardField* pField = (CCardField*)(pProp->GetData());
		if(!pField)
			continue;
		CString sv = CXxwMfcPub::OleVar2Str(pProp->GetValue());
		string sValue = sv.GetBuffer(0);
		pField->sInstantValue = pField->FormatValue(sValue);//修改值
	}

	for(int r = 0; r < m_lstDevicesSelected.GetItemCount(); ++r)
	{
		CCardLine* pLine = (CCardLine*)(m_lstDevicesSelected.GetItemData(r));
		CCard newCard = m_swiCard;
		for (int i = 0 ; i < m_vecKeynames.size(); i++)
		{
			CCardField* pFld = pLine->m_card.FindFieldByKeyname(m_vecKeynames[i]);
			CCardField* pFldNew = newCard.FindFieldByKeyname(m_vecKeynames[i]);
			if (pFld && pFldNew)
			{
				pFldNew->sInstantValue = pFld->sInstantValue;//替换为选择的值
			}
		}
		CCardLine* pLineNew = theApp.m_parserSwi.AddNewCard(newCard);//添加新卡
		m_AllCardsNew.insert(make_pair(newCard.m_sName, pLineNew));
	}

	// 获得父窗口的句柄
	HWND hWnd = m_pParentWnd->GetSafeHwnd();
	// 向父窗口发送消息
	if (hWnd == NULL) 
		return (void)MessageBox(_T("获得父窗口句柄失败!"));
	::SendNotifyMessage(hWnd,WM_MY_ADDCARDS_OK,(WPARAM)0, (LPARAM)0);

	//从“待选”中删除所有的行
	m_lstDevicesSelected.DeleteAllItems();//删除所有的行
	UpdateBtnOK();

	SetFocus();//获得焦点并显示,以免被隐藏
}
LRESULT CDlgAddCards::OnPropertyChanged(WPARAM wparam,LPARAM lParam)
{
	CMFCPropertyGridProperty* pProp = (CMFCPropertyGridProperty*) lParam;
	switch( wparam )
	{
	case(IDC_MFCPROPERTYGRID)://来自控件IDC_MFCPROPERTYGRID1
		{
			CCardField* pField = (CCardField*)pProp->GetData();
			if(!pField)
				return 0;
			CString sv = CXxwMfcPub::OleVar2Str(pProp->GetValue());
			string sValue = sv.GetBuffer(0);
			pField->sInstantValue = pField->FormatValue(sValue);//修改值
		}
		break;
	}

	return 0;
}
LRESULT CWorkspaceBar::OnPropertyChanged (WPARAM,LPARAM lParam)
{
	CMFCPropertyGridProperty* pProp = (CMFCPropertyGridProperty*) lParam;

	BOOL bResetMDIChild = FALSE;

	switch ((int) pProp->GetData ())
	{
	case idShowMDITabs:
		{
			CString strShowMdiTabOption = (LPCTSTR) (_bstr_t)pProp->GetValue ();
			bResetMDIChild = TRUE;

			for (int i = 0; lpszMDITabsStyles [i] != NULL; i++)
			{
				if (strShowMdiTabOption == lpszMDITabsStyles [i])
				{
					switch (i)
					{
					case 0:
						theApp.m_Options.m_nMDITabsType = CMDITabOptions::None;
						break;

					case 1:
						theApp.m_Options.m_nMDITabsType = CMDITabOptions::MDITabsStandard;
						break;

					case 2:
						theApp.m_Options.m_nMDITabsType = CMDITabOptions::MDITabbedGroups;
						theApp.m_Options.m_bMaximizeMDIChild = FALSE;
						CMFCPropertyGridProperty* pMaximizeChildProp = m_wndPropList.GetProperty (1);
						if (pMaximizeChildProp != NULL)
						{
							_variant_t var ((short)theApp.m_Options.m_bMaximizeMDIChild, VT_BOOL);
							pMaximizeChildProp->SetValue (var);
							pMaximizeChildProp->Enable (FALSE);
						}
						bResetMDIChild = FALSE;
						break;
					}
					break;
				}
			}
			
			SetPropState ();
		}
		break;

	case idMaximizeMDIChild:
		theApp.m_Options.m_bMaximizeMDIChild = (bool) pProp->GetValue ();
		bResetMDIChild = TRUE;
		break;

	case idTabsOnTop:
		theApp.m_Options.m_bTabsOnTop = (bool) pProp->GetValue ();
		break;

	case idActiveTabCloseButton:
		theApp.m_Options.m_bActiveTabCloseButton = (bool) pProp->GetValue ();
		break;

	case idTabsStyle:
		{
			CString strStyle = (LPCTSTR) (_bstr_t)pProp->GetValue ();

			for (int i = 0; lpszStyles [i] != NULL; i++)
			{
				if (strStyle == lpszStyles [i])
				{
					switch (i)
					{
					case 0:
						theApp.m_Options.m_nTabsStyle = CMFCTabCtrl::STYLE_3D_SCROLLED;
						break;

					case 1:
						theApp.m_Options.m_nTabsStyle = CMFCTabCtrl::STYLE_3D_ONENOTE;
						break;

					case 2:
						theApp.m_Options.m_nTabsStyle = CMFCTabCtrl::STYLE_3D_VS2005;
						break;
					}
					break;
				}
			}
		}
		break;

	case idTabsAutoColor:
		theApp.m_Options.m_bTabsAutoColor = (bool) pProp->GetValue ();
		break;

	case idMDITabsIcons:
		theApp.m_Options.m_bMDITabsIcons = (bool) pProp->GetValue ();
		break;

	case idMDITabsDocMenu:
		theApp.m_Options.m_bMDITabsDocMenu = (bool) pProp->GetValue ();
		break;

	case idDragMDITabs:
		theApp.m_Options.m_bDragMDITabs = (bool) pProp->GetValue ();
		break;

	case idMDITabsContextMenu:
		theApp.m_Options.m_bMDITabsContextMenu = (bool) pProp->GetValue ();
		break;

	case idMDITabsBorderSize:
		{
			int nBorderSize = pProp->GetValue ().iVal;
			theApp.m_Options.m_nMDITabsBorderSize = min (10, max (0, nBorderSize));
		}
		break;

	case idDisableMDIChildRedraw:
		theApp.m_Options.m_bDisableMDIChildRedraw = (bool) pProp->GetValue ();
		break;

	case idFlatFrame:
		theApp.m_Options.m_bFlatFrame = (bool) pProp->GetValue ();
		break;

	case idCustomTooltips:
		theApp.m_Options.m_bCustomTooltips = (bool) pProp->GetValue ();
		break;
	}

	theApp.UpdateMDITabs (bResetMDIChild);
	return 0;
}