From e4529a949a3c6b305cb6359231e5fe98396b4adc Mon Sep 17 00:00:00 2001 From: andreja6 Date: Tue, 23 Oct 2018 12:46:54 -0700 Subject: [PATCH] Kinda sorta works --- PhysicalInstance.cpp | 2 +- PropertyWindow.cpp | 28 +++++++++++++++++++++++----- 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/PhysicalInstance.cpp b/PhysicalInstance.cpp index 3f772e1..a6aabfb 100644 --- a/PhysicalInstance.cpp +++ b/PhysicalInstance.cpp @@ -242,7 +242,7 @@ std::vector PhysicalInstance::getProperties() "The position of the object in the workspace", (LPARAM)"Coming soon", PIT_EDIT - ), (DWORD)&name)); + ), (DWORD)&position)); return properties; } diff --git a/PropertyWindow.cpp b/PropertyWindow.cpp index 02a9b42..2a6dbdd 100644 --- a/PropertyWindow.cpp +++ b/PropertyWindow.cpp @@ -10,7 +10,8 @@ Property ∝ } PRGP;*/ -//std::vector propvec; +std::vector prop; +Instance* selectedInstance; LRESULT CALLBACK PropProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { PropertyWindow *propWind = (PropertyWindow *)GetWindowLongPtr(hwnd, GWL_USERDATA); @@ -24,9 +25,26 @@ LRESULT CALLBACK PropProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { propWind->onResize(); } - case WM_NOTIFY: - MessageBox(NULL,"Test","Test",0); break; + case WM_NOTIFY: + { + switch(((LPNMHDR)lParam)->code) + { + case PGN_PROPERTYCHANGE: + { + if(selectedInstance != NULL) + { + for(size_t i = 0; i < prop.size(); i++) + { + MessageBox(NULL, (LPCSTR)prop.at(i).item.lpCurValue, "A", MB_OK); + selectedInstance->PropUpdate(prop.at(i).addr, prop.at(i).item); + } + } + } + break; + } + //MessageBox(NULL,"Test","Test",0); + } break; default: return DefWindowProc(hwnd, msg, wParam, lParam); @@ -121,8 +139,8 @@ void PropertyWindow::_redraw() void PropertyWindow::SetProperties(Instance * instance) { PropGrid_ResetContent(_propGrid); - std::vector prop = instance->getProperties(); - + prop = instance->getProperties(); + selectedInstance = instance; for(size_t i = 0; i < prop.size(); i++) { ::PROPGRIDITEM item = prop.at(i).item;