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:
@@ -59,13 +59,15 @@ wxFontDataProperty::wxFontDataProperty( const wxString& label, const wxString& n
|
|||||||
wxFontData fontData(value);
|
wxFontData fontData(value);
|
||||||
|
|
||||||
// Fix 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() )
|
if ( !fontData.GetColour().IsOk() )
|
||||||
fontData.SetColour(*wxBLACK);
|
fontData.SetColour(*wxBLACK);
|
||||||
|
|
||||||
// Set initial value - should be done in a simpler way like this
|
// Set initial value - should be done in a simpler way like this
|
||||||
// (instead of calling SetValue) in derived (wxObject) properties.
|
// (instead of calling SetValue) in derived (wxObject) properties.
|
||||||
m_value_wxFontData << value;
|
m_value_wxFontData << fontData;
|
||||||
|
|
||||||
// Add extra children.
|
// Add extra children.
|
||||||
AddPrivateChild( new wxColourProperty(_("Colour"), wxPG_LABEL,
|
AddPrivateChild( new wxColourProperty(_("Colour"), wxPG_LABEL,
|
||||||
@@ -180,7 +182,7 @@ wxVariant wxFontDataProperty::ChildChanged( wxVariant& thisValue,
|
|||||||
// Transfer from subset to superset.
|
// Transfer from subset to superset.
|
||||||
wxFont font = fontData.GetChosenFont();
|
wxFont font = fontData.GetChosenFont();
|
||||||
variant = WXVARIANT(font);
|
variant = WXVARIANT(font);
|
||||||
wxFontProperty::ChildChanged( variant, childIndex, childValue );
|
variant = wxFontProperty::ChildChanged( variant, childIndex, childValue );
|
||||||
font << variant;
|
font << variant;
|
||||||
fontData.SetChosenFont(font);
|
fontData.SetChosenFont(font);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user