代码修改属性表内参数时,立即刷新到界面(如果当前在显示)

同兴达改信利
bestlqiang 3 years ago
parent 01ce2b3263
commit b497d1b852

@ -2,7 +2,7 @@
#include "Propertie.h" #include "Propertie.h"
#include "LogMgr.h" #include "LogMgr.h"
#include "FileMgr.h" #include "FileMgr.h"
#include "PropertieMgr.h"
CPropertie::CPropertie() CPropertie::CPropertie()
{ {
m_pVal = NULL; m_pVal = NULL;
@ -41,6 +41,18 @@ void CPropertie::PropertyChangeVal(const COleVariant &OleVar)
{ {
m_pModule->OnPropertyChanged(); m_pModule->OnPropertyChanged();
} }
auto & PropertieValMap = gDevicePropertieMgr.m_PropertieValMap;
if (PropertieValMap.size())
{
for (auto & item : PropertieValMap)
{
if ((item.second)->m_pVal == this->m_pVal)
{
(item.first)->SetValue(OleVar);
break;
}
}
}
} }
void CPropertie::WriteRead(bool bRead) void CPropertie::WriteRead(bool bRead)
{ {

@ -21,7 +21,7 @@ public:
private: private:
void WriteToFile(CString &FileName); void WriteToFile(CString &FileName);
void ReadFromFile(CString &FileName); void ReadFromFile(CString &FileName);
private: public:
void * m_pVal;//变量内存地址 void * m_pVal;//变量内存地址
PROPERTIE_TYPE m_Type;//属性的类型 PROPERTIE_TYPE m_Type;//属性的类型
CModule * m_pModule;//变量所属模块变量的地址 CModule * m_pModule;//变量所属模块变量的地址

@ -105,7 +105,6 @@ bool CPropertieMgr::ChangePropertieByVal(void * pVal, _variant_t newVal)
if ((*iter)->GetpVal() == pVal) if ((*iter)->GetpVal() == pVal)
{ {
(*iter)->PropertyChangeVal(newVal); (*iter)->PropertyChangeVal(newVal);
gDevicePropertieMgr.UpdateDevicePropertyPage();
return true; return true;
} }
} }

@ -22,7 +22,7 @@ public:
private: private:
void DelAllPropertieVec(); void DelAllPropertieVec();
private: public:
map<CMFCPropertyGridProperty*,CPropertie*> m_PropertieValMap;//保存变量和属性映射的容器 map<CMFCPropertyGridProperty*,CPropertie*> m_PropertieValMap;//保存变量和属性映射的容器
bool m_bSaveAllPropertie;//保存所有需要存储的属性 bool m_bSaveAllPropertie;//保存所有需要存储的属性
vector<CPropertie*> m_AllPropertieVec;//保存所有需要存储的属性(用来强制保存属性) vector<CPropertie*> m_AllPropertieVec;//保存所有需要存储的属性(用来强制保存属性)

Loading…
Cancel
Save