long style = wxST_SIZEGRIP,
const wxString& name = wxStatusBarNameStr)
{
+ m_pDC = NULL;
(void)Create(parent, id, style, name);
}
SetFieldsCount(1);
SubclassWin(m_hWnd);
+
+ // cache the DC instance used by UpdateFieldText:
+ // NOTE: create the DC before calling InheritAttributes() since
+ // it may result in a call to our SetFont()
+ m_pDC = new wxClientDC(this);
+
InheritAttributes();
SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_MENUBAR));
// work correctly, we need to wait until we return to the main loop
PostSizeEventToParent();
- // cache the DC instance used by UpdateFieldText
- m_pDC = new wxClientDC(this);
-
return true;
}
// frame is not - otherwise statusbar leaves a hole in the place it used to
// occupy
PostSizeEventToParent();
+
+ wxDELETE(m_pDC);
}
bool wxStatusBar::SetFont(const wxFont& font)
if (!wxWindow::SetFont(font))
return false;
- m_pDC->SetFont(font);
+ if (m_pDC) m_pDC->SetFont(font);
return true;
}