S
sbrothy
Guest
I put the extra value in CMFCPropertyGridProperty (dwData, GetData()/ SetData()) to work storing the function pointer back to the getter/setter to which it applies. I've had luck storing it like this:
[CSettings]
typedef void *(CHermesSettings::*GetSet)(void *);
[/CSettings]
[PropertySettings]
CMFCPropertyGridProperty *tmp = new CMFCPropertyGridProperty(_T("Auto open Mail Detail"), (_variant_t)pSettings->m_bAutoOpenAddressInfo, _T("Open Mail Detail on document open."));
GetSet f = &CHermesSettings::SetAutoOpenMailDetail;
DWORD_PTR ptr = (DWORD_PTR)&f;
TRACE(_T("[GetData=%lu]"), (DWORD)tmp->GetData());
TRACE(_T("[ptr=%lu]"), (DWORD)ptr);
tmp->SetData(ptr);
pGroupGeneral->AddSubItem(tmp);
[/PropertySettings]
Pulling it out again.. not so mcuh:
[PropertySettings]
LRESULT CPropertiesWnd::OnPropertyChanged(WPARAM wParam, LPARAM lParam)
{
TRACE("LRESULT CPropertiesWnd::OnPropertyChanged(WPARAM wParam, LPARAM lParam) >>\n");
// Parameters:
// [in] wParam: the control ID of the CMFCPropertyGridCtrl that changed.
// [in] lParam: pointer to the CMFCPropertyGridProperty that changed.
// Return value:
// Not used.
// Cast the lparam to a property.
CMFCPropertyGridProperty * pProperty = (CMFCPropertyGridProperty *)lParam;
DWORD_PTR p = pProperty->GetData();
DWORD_PTR ptr = (DWORD_PTR)&p;
//GetSet s = p;
TRACE(_T("[HIERACHYLEVEL=%d][NAME=%s][VALUE=%s][DATA=%lu]\n"), pProperty->GetHierarchyLevel(), pProperty->GetName(), (pProperty->GetValue() ? _T("TRUE") : _T("FALSE")), pProperty->GetValue());
[/PropertySettings]
Any ideas? It´s those pesky member pointers. I seem to remember reading quite a lot of it but it obviously never stuck.
Continue reading...
[CSettings]
typedef void *(CHermesSettings::*GetSet)(void *);
[/CSettings]
[PropertySettings]
CMFCPropertyGridProperty *tmp = new CMFCPropertyGridProperty(_T("Auto open Mail Detail"), (_variant_t)pSettings->m_bAutoOpenAddressInfo, _T("Open Mail Detail on document open."));
GetSet f = &CHermesSettings::SetAutoOpenMailDetail;
DWORD_PTR ptr = (DWORD_PTR)&f;
TRACE(_T("[GetData=%lu]"), (DWORD)tmp->GetData());
TRACE(_T("[ptr=%lu]"), (DWORD)ptr);
tmp->SetData(ptr);
pGroupGeneral->AddSubItem(tmp);
[/PropertySettings]
Pulling it out again.. not so mcuh:
[PropertySettings]
LRESULT CPropertiesWnd::OnPropertyChanged(WPARAM wParam, LPARAM lParam)
{
TRACE("LRESULT CPropertiesWnd::OnPropertyChanged(WPARAM wParam, LPARAM lParam) >>\n");
// Parameters:
// [in] wParam: the control ID of the CMFCPropertyGridCtrl that changed.
// [in] lParam: pointer to the CMFCPropertyGridProperty that changed.
// Return value:
// Not used.
// Cast the lparam to a property.
CMFCPropertyGridProperty * pProperty = (CMFCPropertyGridProperty *)lParam;
DWORD_PTR p = pProperty->GetData();
DWORD_PTR ptr = (DWORD_PTR)&p;
//GetSet s = p;
TRACE(_T("[HIERACHYLEVEL=%d][NAME=%s][VALUE=%s][DATA=%lu]\n"), pProperty->GetHierarchyLevel(), pProperty->GetName(), (pProperty->GetValue() ? _T("TRUE") : _T("FALSE")), pProperty->GetValue());
[/PropertySettings]
Any ideas? It´s those pesky member pointers. I seem to remember reading quite a lot of it but it obviously never stuck.
Continue reading...