SetFont breaks multi-line wxStaticText on wxMac 2.8.0

Alicia da Conceicao alicia454 at gmail.com
Sat Dec 16 00:39:29 PST 2006


For wxMac 2.8.0, when you use SetFont for a wxStaticText widget
with more than one line, separated by line feeds, the widget breaks
and only the first line is rendered.

Consider the following trivial patch for "samples/wizard/wizard.cpp",
where I only added a SetFont method:

====================================================
--- samples/wizard/wizard.cpp.orig     2006-12-16 02:45:58.000000000 -0500
+++ samples/wizard/wizard.cpp  2006-12-16 02:25:12.000000000 -0500
@@ -375,12 +375,13 @@
     // a wizard page may be either an object of predefined class
     m_page1 = new wxWizardPageSimple(this);

-    /* wxStaticText *text = */ new wxStaticText(m_page1, wxID_ANY,
+    wxStaticText *text = new wxStaticText(m_page1, wxID_ANY,
              _T("This wizard doesn't help you\nto do anything at all.\n")
              _T("\n")
              _T("The next pages will present you\nwith more useless
controls."),
              wxPoint(5,5)
         );
+    text->SetFont (wxFont (9, wxMODERN, wxNORMAL, wxNORMAL));

     // ... or a derived class
     wxRadioboxPage *page3 = new wxRadioboxPage(this);
====================================================

For wxMac 2.8.0, in the original wizard sample, when you go to the
menu and select: [File]->[Run wizard modal...] you see all of the lines
of the text of the above wxStaticText widget.  Then when you run the
modified wizard sample with the additional SetFont method, only the
first line of the wxStaticText is rendered!

Please note that the SetFont method worked for wxStaticText on the
all of previous wxMac 2.6.3, 2.6.2, 2.6.1, ..., 2.5.* versions.

Multi-line wxStaticText widgets are needed for many applications;
there are even used in the sample apps!  And there are many reasons
that setting a specific font for a multi-line wxStaticText is also necessary.

Note that this bug was the cause of my sizing issues for wxMac 2.8.0
that I posted earlier.  Please let me know if there is any additional info
or testing that I can provide on my side.

Yours truly,
Alicia.




More information about the wx-users mailing list