]> git.saurik.com Git - wxWidgets.git/blobdiff - src/os2/choice.cpp
Applied patch [ 686843 ] File Dialog Wildcard Bug
[wxWidgets.git] / src / os2 / choice.cpp
index a39235977d1c236824aa990416d41ef5424fc6ec..5ae8def9d95b1fb354d45f41c700eca51a168941 100644 (file)
@@ -31,24 +31,20 @@ bool wxChoice::Create(
 , int                               n
 , const wxString                    asChoices[]
 , long                              lStyle
-#if wxUSE_VALIDATORS
 , const wxValidator&                rValidator
-#endif
 , const wxString&                   rsName
 )
 {
     long                            lSstyle;
 
-    if (!OS2CreateControl( pParent
-                          ,vId
-                          ,rPos
-                          ,rSize
-                          ,lStyle
-#if wxUSE_VALIDATORS
-                          ,rValidator
-#endif
-                          ,rsName
-                         ))
+    if (!CreateControl( pParent
+                       ,vId
+                       ,rPos
+                       ,rSize
+                       ,lStyle
+                       ,rValidator
+                       ,rsName
+                      ))
         return FALSE;
     lSstyle = CBS_DROPDOWNLIST |
               WS_TABSTOP       |
@@ -189,6 +185,16 @@ void wxChoice::SetString(
 )
 {
     SHORT                           nIndexType = 0;
+    void*                           pData;
+
+    if ( m_clientDataItemsType != wxClientData_None )
+    {
+        pData = DoGetItemClientData(n);
+    }
+    else // no client data
+    {
+        pData = NULL;
+    }
 
     ::WinSendMsg(GetHwnd(), LM_DELETEITEM, (MPARAM)n, 0);
 
@@ -201,6 +207,13 @@ void wxChoice::SetString(
                  ,(MPARAM)nIndexType
                  ,(MPARAM)rsStr.c_str()
                 );
+
+    if (pData)
+    {
+        DoSetItemClientData( n
+                            ,pData
+                           );
+    }
 } // end of wxChoice::SetString
 
 wxString wxChoice::GetString(
@@ -212,7 +225,7 @@ wxString wxChoice::GetString(
     char*                           zBuf;
 
     nLen = (size_t)LONGFROMMR(::WinSendMsg(GetHwnd(), LM_QUERYITEMTEXTLENGTH, (MPARAM)n, (MPARAM)0));
-    if (nLen)
+    if (nLen != LIT_ERROR && nLen > 0)
     {
         zBuf = new char[nLen + 1];
         ::WinSendMsg( GetHwnd()