Andrew Truckle
Andrew Truckle

Reputation: 19197

How do I embed (and use) a button in a CMFCPropertyGridProperty?

I notice this API call: CMFCPropertyGridProperty::AdjustButtonRect. But how do I add a button to a CMFCPropertyGridProperty? I would like to show a custom button on the right and manage clicking the button.

Related question:

Drawing my own embedded button with CMFCPropertyGridProperty and detecting the button state

Upvotes: -2

Views: 181

Answers (1)

Andrew Truckle
Andrew Truckle

Reputation: 19197

After further research I found another conversation on CodeProject saying to use HasButton(). If I add this override to my class:

BOOL HasButton() const
{
    return TRUE;
}

Then it will show ... on the right, which is at-least a step forward!

Then, I used the code search feature in Visual Studio 2022 and noticed an undocumented method (OnClickButton)! If I override it:

virtual void OnClickButton(CPoint point)
{
    AfxMessageBox(L"Button clicked!");

}

Upvotes: 0

Related Questions