0

I have found very little documentation when it comes to the C++ Feature Pack and all the examples I have found all are the same example. The problem I am experiencing involves EnableAutomaticButton in the color panel. If I set the default color to black as in the following code clicking the button makes the color white (ffffff). After checking the return value I found it is returning -1 so in other words FALSE and does not return black but everything else returns correctly even the color chips in the popup box.

CMFCPropertyGridProperty* pGroup2 = new CMFCPropertyGridProperty(_T("View"));

CMFCPropertyGridColorProperty* pColorProp = new   CMFCPropertyGridColorProperty(_T("Color"), RGB(0, 0, 0), NULL, _T("Specifies the default View color"));
pColorProp->EnableOtherButton(_T("Other..."),TRUE,TRUE);
pColorProp->EnableAutomaticButton(_T("Default"),RGB(0,0,0),TRUE);
pColorProp->SetColor(RGB(0,0,0));
pColorProp->SetColumnsNumber(5);

pGroup2->AddSubItem(pColorProp);
RobNHood
  • 119
  • 1
  • 2
  • 11
  • have you found a fix for this? – Robson Apr 14 '15 at 11:16
  • do you really need to do this dynamically or can't you just create this on the XML? – Robson Apr 14 '15 at 11:24
  • I just took out the automatic button and not giving the option to revert back to the default color. I have not found a fix and I think this is just a bug within the API itself. I can use a standard color box or even create my own except it would defeat the purpose of the feature pack and it is not a main feature of the program so I am not going to go through that trouble. – RobNHood Apr 15 '15 at 13:22

1 Answers1

1

yes, GetColor(); return -1 for automatic selection. So try something like;-

m_Colour = m_ColourBut.GetColor();

// Handle the default colour selection.
if (m_Colour == -1)
{
    m_Colour = m_ColourBut.GetAutomaticColor();
}
MrCrisp
  • 11
  • 1