wxControl::SetLabel no longer strips out codes so do it here

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@37237 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart
2006-01-31 16:01:19 +00:00
parent 4c410aa14e
commit bd1a4a99fc
2 changed files with 16 additions and 10 deletions

View File

@@ -61,12 +61,13 @@ bool wxStaticText::Create(wxWindow *parent,
return FALSE;
}
// notice that we call the base class version which will just remove the
// '&' characters from the string, but not set the label's text to it
// the base class version which
// will not set the label's text to it
// because the label is not yet created and because SetLabel() has a side
// effect of changing the control size which might not be desirable
wxString label1(wxStripMenuCodes(label));
wxControl::SetLabel(label);
m_widget = gtk_label_new( wxGTK_CONV( m_label ) );
m_widget = gtk_label_new( wxGTK_CONV( label1 ) );
GtkJustification justify;
if ( style & wxALIGN_CENTER )
@@ -101,7 +102,9 @@ void wxStaticText::SetLabel( const wxString &label )
{
wxControl::SetLabel(label);
gtk_label_set( GTK_LABEL(m_widget), wxGTK_CONV( m_label ) );
wxString label1(wxStripMenuCodes(label));
gtk_label_set( GTK_LABEL(m_widget), wxGTK_CONV( label1 ) );
// adjust the label size to the new label unless disabled
if (!HasFlag(wxST_NO_AUTORESIZE))