CMFCPropertyGrid
- Hello,Noob question, how can I link a CMFCPropertyGridProperty to a variable in my program?I want a double var to be updated using the Properties Window.I've struggled understanding the DWORD_PTR value. I don't care about validation... I just want to change the value in the window and be it reflected in RAM.This is what I've done so far:1. Made a menu that will display a MessageBox with the value of the variable2. Added the Property to the PropertyGridI'm able to update it (supposedly) but when I display the value it stays the same.Thank you for your help..
Respostas
Try to locate "MDITabsDemo" among the samples for VC2008SP1. In this sample CMFCPropertyGridProperty is used to update attributes in the application class.
The parameter DWORD_PTR dwData is not the actual value to be edited but a ID-value you can pick up later with CMFCPropertyGridProperty::GetData(), for example in your handler of the message AFX_WM_PROPERTY_CHANGED in order to know what attribute has been changed.
- Marcado como RespostaPechFromTj quarta-feira, 4 de novembro de 2009 19:41
Todas as Respostas
- I've struggled understanding the DWORD_PTR value.
DWORD_PTR becomes a 32-bit unsigned value in a 32-bit build and a 64-bit unsigned value in a 64-bit build without changing any code.
«_Superman_»
Microsoft MVP (Visual C++) - Yeah, I kind of understand that part, but the thing is, how do I change the value of a variable using the CMFCPropertyGrid.
Try to locate "MDITabsDemo" among the samples for VC2008SP1. In this sample CMFCPropertyGridProperty is used to update attributes in the application class.
The parameter DWORD_PTR dwData is not the actual value to be edited but a ID-value you can pick up later with CMFCPropertyGridProperty::GetData(), for example in your handler of the message AFX_WM_PROPERTY_CHANGED in order to know what attribute has been changed.
- Marcado como RespostaPechFromTj quarta-feira, 4 de novembro de 2009 19:41
Thank you very much.... at least I have some code to analyze and try to understand! The wizard just gives you some code but that it's not linked to actual variables , but with the sample, I'm sure I'll figure out how it works.Try to locate "MDITabsDemo" among the samples for VC2008SP1. In this sample CMFCPropertyGridProperty is used to update attributes in the application class.
The parameter DWORD_PTR dwData is not the actual value to be edited but a ID-value you can pick up later with CMFCPropertyGridProperty::GetData(), for example in your handler of the message AFX_WM_PROPERTY_CHANGED in order to know what attribute has been changed.
Thank you!I did a workaround, deriving my own PropertyGridCtrl and PropertyGridProperty, overriding the OnPropertyChanged adding some methods (overloaded) using pointers to the variables, it works ok, but I want to know how I'm supposed to do it using MFC methods. Once again, thank you!

