Strip mnemonics from the label before passing it to Cocoa.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@47570 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
David Elliott 2007-07-19 19:19:52 +00:00
parent 259502c61d
commit c978d28a2a

View File

@ -44,7 +44,7 @@ bool wxStaticText::Create(wxWindow *parent, wxWindowID winid,
m_cocoaNSView = NULL; m_cocoaNSView = NULL;
SetNSTextField([[NSTextField alloc] initWithFrame:MakeDefaultNSRect(size)]); SetNSTextField([[NSTextField alloc] initWithFrame:MakeDefaultNSRect(size)]);
[m_cocoaNSView release]; [m_cocoaNSView release];
[GetNSTextField() setStringValue:wxNSStringWithWxString(label)]; [GetNSTextField() setStringValue:wxNSStringWithWxString(wxStripMenuCodes(label, wxStrip_Mnemonics))];
// [GetNSTextField() setBordered: NO]; // [GetNSTextField() setBordered: NO];
[GetNSTextField() setBezeled: NO]; [GetNSTextField() setBezeled: NO];
[GetNSTextField() setEditable: NO]; [GetNSTextField() setEditable: NO];
@ -70,7 +70,7 @@ wxStaticText::~wxStaticText()
void wxStaticText::SetLabel(const wxString& label) void wxStaticText::SetLabel(const wxString& label)
{ {
[GetNSTextField() setStringValue:wxNSStringWithWxString(label)]; [GetNSTextField() setStringValue:wxNSStringWithWxString(wxStripMenuCodes(label, wxStrip_Mnemonics))];
NSRect oldFrameRect = [GetNSTextField() frame]; NSRect oldFrameRect = [GetNSTextField() frame];
NSView *superview = [GetNSTextField() superview]; NSView *superview = [GetNSTextField() superview];
wxLogTrace(wxTRACE_COCOA_Window_Size, wxT("wxStaticText::SetLabel Old Position: (%d,%d)"), GetPosition().x, GetPosition().y); wxLogTrace(wxTRACE_COCOA_Window_Size, wxT("wxStaticText::SetLabel Old Position: (%d,%d)"), GetPosition().x, GetPosition().y);