I'm an Italian new C++ programmer and I need help to solve a problem that I think wuold be very easy for normal or well skilled C++ programmer.
I have installed MFC Feature pack and I'm trying to retrieve a value from a CMFCPropertyGridProperty object. I want to retrieve a color value. I have two major problems. The first in what way I can call the various subitem in my grid object? The next Problem is in what way I can retrieve the color value from the palette (If I do this where the palette is defined I can use the GetColor() method but i can't use this method if I try to do this in any other part of the application). I'm triyng to use the color palette in order to make a drawcli like application
Thank you for the help.
I am not really familiar with these kind of objects. But post your code so we can find the problem. Post part of your code that seems to have the problem if you prefer
Thank you for your disponibility...so that's the code
I'm trying to retrieve the value this item gives anytime that it change...
CMFCPropertyGridColorProperty* pColorProp = new CMFCPropertyGridColorProperty(_T
("Colore della finestra"), RGB(210, 192, 254), NULL, _T("Specifica il colore predefinito della finestra."));
Thank you for your help
Well, I would need to see all the code to say 100%
But what you are doing is declaring a pointer pColorProp inside a function. So it has LOCAL scope. That means that when the function returns the pointer is gone. And you cannot access the memory pointed by it which was allocated with new. So you will also have a memory leak.
What you want to do is have the pointer declared somewhere else. For example if you want the access the object in a global scope (or other scope depending where this code is) you can do this:
There are other ways, but I think this is what you want
pColorProp = new CMFCPropertyGridColorProperty(_T...
Excuse me but the problem is a little more difficult. Prior to this discussion I have proved to declar a COLORREF variable to save the value retrieved by the menu palette in a global way but my problem is that there isn't a listener that update the value of my variable any time that it change. I'm finding the way to do something similiar at the ON_OK command in dialog control. So I can change the color of the draw I make...If it can help I will publish all the class CPropertiesWnd, but I think it is a bit longer since I can post it here. I hope that I have explained my problema better. Thank you another time