Ticket #16768: modified-sample.patch

File modified-sample.patch, 1.7 KB (added by awi, 6 years ago)

Modified sample reproducing the issue.

  • samples/propgrid/propgrid_minimal.cpp

    diff --git a/samples/propgrid/propgrid_minimal.cpp b/samples/propgrid/propgrid_minimal.cpp
    a b MyFrame::MyFrame(wxWindow* parent) 
    4646                        wxPG_BOLD_MODIFIED );
    4747    m_pg = pg;
    4848
    49     pg->Append( new wxStringProperty("String Property", wxPG_LABEL) );
    50     pg->Append( new wxIntProperty("Int Property", wxPG_LABEL) );
    51     pg->Append( new wxBoolProperty("Bool Property", wxPG_LABEL) );
     49//    pg->Append( new wxStringProperty("String Property", wxPG_LABEL) );
     50//    pg->Append( new wxIntProperty("Int Property", wxPG_LABEL) );
     51//    pg->Append( new wxBoolProperty("Bool Property", wxPG_LABEL) );
     52
     53    pg->Append(  new wxStringProperty( "A", wxPG_LABEL, "av") );
     54    pg->Append(  new wxStringProperty( "B", wxPG_LABEL, "bv") );
     55    pg->Append(  new wxStringProperty( "C", wxPG_LABEL, "cv") );
    5256
    5357    SetSize(400, 600);
    5458}
    void MyFrame::OnPropertyGridChanging(wxPropertyGridEvent &event) 
    7781
    7882void MyFrame::OnAction(wxCommandEvent &)
    7983{
     84    wxString msg1;
     85    wxPropertyGridIterator it;
     86    for ( it = m_pg->GetIterator(); !it.AtEnd(); it-- )
     87    {
     88        // add item label and value to string
     89        wxPGProperty* p = *it;
     90        msg1 += p->GetLabel() + " : " + p->GetValueAsString() + "\n";
     91    }
     92
     93    wxString msg2;
     94    for ( it = m_pg->GetIterator(wxPG_ITERATE_DEFAULT, wxBOTTOM ); !it.AtEnd(); it-- )
     95    {
     96        // add item label and value to string
     97        wxPGProperty* p = *it;
     98        msg2 += p->GetLabel() + " : " + p->GetValueAsString() + "\n";
     99    }
     100
     101    wxMessageBox( "\n" + msg1 + "\n" + msg2);
    80102}
    81103
    82104// Called from propgridsample.cpp