From d37bb826ef4aeb1ecb59c37c5747a10e73340ce7 Mon Sep 17 00:00:00 2001 From: Stefan Neis Date: Sun, 15 Feb 2004 18:00:27 +0000 Subject: [PATCH] Added accelerator handling for buttons and infrastructure to do the same for other controls (patch 893580). git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@25825 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/os2/control.h | 2 ++ src/os2/button.cpp | 5 ++++- src/os2/control.cpp | 9 +++++++++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/include/wx/os2/control.h b/include/wx/os2/control.h index 496c270191..396cf35fef 100644 --- a/include/wx/os2/control.h +++ b/include/wx/os2/control.h @@ -50,6 +50,8 @@ public: ,const wxString& rsName = wxControlNameStr ); + virtual void SetLabel(const wxString& rsLabel); + // // Simulates an event // diff --git a/src/os2/button.cpp b/src/os2/button.cpp index c47b6dce32..7e0a49ebf0 100644 --- a/src/os2/button.cpp +++ b/src/os2/button.cpp @@ -51,6 +51,9 @@ bool wxButton::Create( , const wxString& rsName ) { + + wxString sLabel = ::wxPMTextToLabel(rsLabel); + SetName(rsName); #if wxUSE_VALIDATORS SetValidator(rValidator); @@ -73,7 +76,7 @@ bool wxButton::Create( m_hWnd = (WXHWND)::WinCreateWindow( GetHwndOf(pParent) // Parent handle ,WC_BUTTON // A Button class window - ,(PSZ)rsLabel.c_str() // Button text + ,(PSZ)sLabel.c_str() // Button text ,lStyle // Button style ,0, 0, 0, 0 // Location and size ,GetHwndOf(pParent) // Owner handle diff --git a/src/os2/control.cpp b/src/os2/control.cpp index 324ea885b2..1dd3f453d1 100644 --- a/src/os2/control.cpp +++ b/src/os2/control.cpp @@ -240,6 +240,15 @@ WXDWORD wxControl::OS2GetStyle( return dwStyle; } // end of wxControl::OS2GetStyle +void wxControl::SetLabel( + const wxString& rsLabel +) +{ + wxString sLabel = ::wxPMTextToLabel(rsLabel); + + ::WinSetWindowText(GetHwnd(), sLabel.c_str()); +} // end of wxControl::SetLabel + // --------------------------------------------------------------------------- // global functions // ---------------------------------------------------------------------------