diff --git a/samples/propgrid/propgrid.cpp b/samples/propgrid/propgrid.cpp index 4cce1563e2..0951bf00a2 100644 --- a/samples/propgrid/propgrid.cpp +++ b/samples/propgrid/propgrid.cpp @@ -2319,18 +2319,19 @@ void FormMain::OnDelPropRClick( wxCommandEvent& WXUNUSED(event) ) for (;;) { + if ( p->GetChildCount() == 0 ) + break; + + unsigned int n = static_cast(rand()) % p->GetChildCount(); + p = p->Item(n); + if ( !p->IsCategory() ) { - m_pPropGridManager->DeleteProperty( p ); + wxString label = p->GetLabel(); + m_pPropGridManager->DeleteProperty(p); + wxLogMessage("Property deleted: %s", label); break; } - - if ( !p->GetChildCount() ) - break; - - int n = rand() % ((int)p->GetChildCount()); - - p = p->Item(n); } }