If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
class MyFrame : public wxFrame
{
private:
wxPropertyGrid* pg;
void OnPropertyGridItemRightClick( wxPropertyGridEvent& event );
DECLARE_EVENT_TABLE()
};
BEGIN_EVENT_TABLE(MyFrame, wxFrame) EVT_PG_RIGHT_CLICK(wxID_ANY,MyFrame::OnPropertyGridItemRightClick )
END_EVENT_TABLE()
void MyFrame::OnPropertyGridItemRightClick( wxPropertyGridEvent& event )
{
wxPGProperty* p = event.GetProperty();
if ( p )
{
if (p->IsCategory())
{
pg->DeleteProperty ( p ); //here is a problem and property can not be deleted
}
}
}
It looks like this bug. May be you're using an old version of wxPropGrid, or the bug is not fully fixed for right_click event.
Try to post a custom event to remove the property out of the right click handler (I think the pb comes from the fact the property is used after OnPropertyGridItemRightClick is called in wxPropertyGrid library) :