Search code examples
c++fontswxwidgets

SetFont()-function does not work for wxFrame


I have quite a simple piece of code to set a three times bigger font for my wxFrame:

MainWin::MainWin()
       : wxFrame(NULL, wxID_ANY,wxEmptyString,
                 wxPoint(20,10), wxSize(1000, 600),
                 wxDEFAULT_FRAME_STYLE)
{
   wxFont font=GetFont();
   font=font.Scale(3.0);
   bool done=SetFont(font);

   wxMessageBox("test", "test", 5, this);

My problem: it does not work! Neither the wxMessageBox nor the title bar of the wxFrame nor any other children make use of this bigger font.

So...any idea what is wrong here?

Thanks!


Solution

  • wxFrame font will be inherited by its (non-toplevel) children, so it's not completely useless to set it, but it won't be used neither for its title bar nor for any message boxes shown by it, as both of those use the system-defined font outside of the control of the application.