From 8cf4b0651f5414254281bb7d330b6fc547321f71 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Thu, 29 Aug 2013 20:44:58 +0000 Subject: [PATCH] Initialize wxImageFileProperty correctly when file is given in the ctor. Previously the file had to be specified later and the value passed to the ctor was ignored. Closes #15456. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74729 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/propgrid/advprops.h | 4 ++++ src/propgrid/advprops.cpp | 7 +++++++ 2 files changed, 11 insertions(+) diff --git a/include/wx/propgrid/advprops.h b/include/wx/propgrid/advprops.h index 16bda4ed91..16930c4bb9 100644 --- a/include/wx/propgrid/advprops.h +++ b/include/wx/propgrid/advprops.h @@ -329,6 +329,10 @@ public: protected: wxBitmap* m_pBitmap; // final thumbnail area wxImage* m_pImage; // intermediate thumbnail area + +private: + // Initialize m_pImage using the current file name. + void LoadImageFromFile(); }; #endif diff --git a/src/propgrid/advprops.cpp b/src/propgrid/advprops.cpp index 2d7ab44cf4..4e1592ac4d 100644 --- a/src/propgrid/advprops.cpp +++ b/src/propgrid/advprops.cpp @@ -1827,6 +1827,8 @@ wxImageFileProperty::wxImageFileProperty( const wxString& label, const wxString& m_pImage = NULL; m_pBitmap = NULL; + + LoadImageFromFile(); } wxImageFileProperty::~wxImageFileProperty() @@ -1845,6 +1847,11 @@ void wxImageFileProperty::OnSetValue() wxDELETE(m_pImage); wxDELETE(m_pBitmap); + LoadImageFromFile(); +} + +void wxImageFileProperty::LoadImageFromFile() +{ wxFileName filename = GetFileName(); // Create the image thumbnail -- 2.45.2