From f7f941a6c1779e160ed95b972cf5a3532b3a9bcb Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Thu, 22 May 2014 14:35:55 +0000 Subject: [PATCH] Fix changing individual font properties in the propgrid sample. Fixes the bug in the sample which resulted in the UI not working as expected. Closes #12779. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@76596 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- samples/propgrid/sampleprops.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/samples/propgrid/sampleprops.cpp b/samples/propgrid/sampleprops.cpp index 9117e2abaa..e88785eb45 100644 --- a/samples/propgrid/sampleprops.cpp +++ b/samples/propgrid/sampleprops.cpp @@ -59,13 +59,15 @@ wxFontDataProperty::wxFontDataProperty( const wxString& label, const wxString& n wxFontData fontData(value); // Fix value. - fontData.SetChosenFont(value.GetInitialFont()); + wxFont font; + font << m_value; // Get font data from base object. + fontData.SetChosenFont(font); if ( !fontData.GetColour().IsOk() ) fontData.SetColour(*wxBLACK); // Set initial value - should be done in a simpler way like this // (instead of calling SetValue) in derived (wxObject) properties. - m_value_wxFontData << value; + m_value_wxFontData << fontData; // Add extra children. AddPrivateChild( new wxColourProperty(_("Colour"), wxPG_LABEL, @@ -180,7 +182,7 @@ wxVariant wxFontDataProperty::ChildChanged( wxVariant& thisValue, // Transfer from subset to superset. wxFont font = fontData.GetChosenFont(); variant = WXVARIANT(font); - wxFontProperty::ChildChanged( variant, childIndex, childValue ); + variant = wxFontProperty::ChildChanged( variant, childIndex, childValue ); font << variant; fontData.SetChosenFont(font); }