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
This commit is contained in:
Vadim Zeitlin
2014-05-22 14:35:55 +00:00
parent d96fd33985
commit f7f941a6c1

View File

@@ -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);
}