]> git.saurik.com Git - wxWidgets.git/blobdiff - src/os2/menuitem.cpp
another segfault fix
[wxWidgets.git] / src / os2 / menuitem.cpp
index af97aab35a6613c776d1a4536afaa0c79e7e2052..6b4c37c65ae5c6ed02bb4fcdbee65442de8da1e7 100644 (file)
@@ -62,7 +62,7 @@ static wxString TextToLabel(const wxString& rTitle)
 {
     wxString Title;
     const wxChar *pc;
 {
     wxString Title;
     const wxChar *pc;
-    for (pc = rTitle; *pc != wxT('\0'); pc++ )
+    for (pc = rTitle.c_str(); *pc != wxT('\0'); pc++ )
     {
         if (*pc == wxT('&') )
         {
     {
         if (*pc == wxT('&') )
         {
@@ -71,13 +71,9 @@ static wxString TextToLabel(const wxString& rTitle)
                 pc++;
                 Title << wxT('&');
             }
                 pc++;
                 Title << wxT('&');
             }
-            else 
+            else
                 Title << wxT('~');
         }
                 Title << wxT('~');
         }
-//         else if (*pc == wxT('/'))
-//         {
-//             Title << wxT('\\');
-//         }
         else
         {
             if ( *pc == wxT('~') )
         else
         {
             if ( *pc == wxT('~') )
@@ -155,6 +151,8 @@ wxMenuItem::wxMenuItem(
     m_text        = TextToLabel(rText);
     m_isCheckable = bCheckable;
     m_help        = rStrHelp;
     m_text        = TextToLabel(rText);
     m_isCheckable = bCheckable;
     m_help        = rStrHelp;
+    memset(&m_vMenuData, '\0', sizeof(m_vMenuData));
+    m_vMenuData.id= nId;
 } // end of wxMenuItem::wxMenuItem
 
 wxMenuItem::~wxMenuItem()
 } // end of wxMenuItem::wxMenuItem
 
 wxMenuItem::~wxMenuItem()
@@ -206,18 +204,6 @@ wxString wxMenuItemBase::GetLabelFromText(
     return label;
 }
 
     return label;
 }
 
-// accelerators
-// ------------
-
-#if wxUSE_ACCEL
-
-wxAcceleratorEntry *wxMenuItem::GetAccel() const
-{
-    return wxGetAccelFromString(GetText());
-}
-
-#endif // wxUSE_ACCEL
-
 // change item state
 // -----------------
 
 // change item state
 // -----------------
 
@@ -233,13 +219,13 @@ void wxMenuItem::Enable(
         bOk = (bool)::WinSendMsg( GetHMenuOf(m_parentMenu)
                                  ,MM_SETITEMATTR
                                  ,MPFROM2SHORT(GetRealId(), TRUE)
         bOk = (bool)::WinSendMsg( GetHMenuOf(m_parentMenu)
                                  ,MM_SETITEMATTR
                                  ,MPFROM2SHORT(GetRealId(), TRUE)
-                                 ,MPFROM2SHORT(MIA_DISABLED, MIA_DISABLED)
+                                 ,MPFROM2SHORT(MIA_DISABLED, FALSE)
                                 );
     else
         bOk = (bool)::WinSendMsg( GetHMenuOf(m_parentMenu)
                                  ,MM_SETITEMATTR
                                  ,MPFROM2SHORT(GetRealId(), TRUE)
                                 );
     else
         bOk = (bool)::WinSendMsg( GetHMenuOf(m_parentMenu)
                                  ,MM_SETITEMATTR
                                  ,MPFROM2SHORT(GetRealId(), TRUE)
-                                 ,MPFROM2SHORT(MIA_DISABLED, FALSE)
+                                 ,MPFROM2SHORT(MIA_DISABLED, MIA_DISABLED)
                                 );
     if (!bOk)
     {
                                 );
     if (!bOk)
     {
@@ -271,7 +257,7 @@ void wxMenuItem::Check(
                                 );
     if (!bOk)
     {
                                 );
     if (!bOk)
     {
-        wxLogLastError("EnableMenuItem");
+        wxLogLastError("CheckMenuItem");
     }
     wxMenuItemBase::Check(bCheck);
 } // end of wxMenuItem::Check
     }
     wxMenuItemBase::Check(bCheck);
 } // end of wxMenuItem::Check