]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/choice.cpp
generate key events for Space/Enter in addition to the activate events, as wxMSW...
[wxWidgets.git] / src / msw / choice.cpp
index 32b36c3603fd51618f724505ebebe7c270c9ea4f..f57a180cac5f8c8bcfd48db768e8f0f6f9ea7ce5 100644 (file)
@@ -200,13 +200,22 @@ void wxChoice::SetString(int n, const wxString& s)
 
 wxString wxChoice::GetString(int n) const
 {
-    size_t len = (size_t)::SendMessage(GetHwnd(), CB_GETLBTEXTLEN, n, 0);
+    int len = (int)::SendMessage(GetHwnd(), CB_GETLBTEXTLEN, n, 0);
+
     wxString str;
-    if (len) {
-        if ( ::SendMessage(GetHwnd(), CB_GETLBTEXT, n,
-                           (LPARAM)str.GetWriteBuf(len)) == CB_ERR ) {
+    if ( len != CB_ERR && len > 0 )
+    {
+        if ( ::SendMessage
+               (
+                GetHwnd(),
+                CB_GETLBTEXT,
+                n,
+                (LPARAM)(wxChar *)wxStringBuffer(str, len)
+               ) == CB_ERR )
+        {
             wxLogLastError(wxT("SendMessage(CB_GETLBTEXT)"));
         }
+
         str.UngetWriteBuf();
     }
 
@@ -281,8 +290,7 @@ void wxChoice::DoSetSize(int x, int y,
     // the _displayed_ size (NOT the drop down menu size) so
     // setting-getting-setting size would not work.
 
-    wxSize sz = GetSize();
-    wxControl::DoSetSize(x, y, width, sz.y, sizeFlags);
+    wxControl::DoSetSize(x, y, width, -1, sizeFlags);
 }
 
 wxSize wxChoice::DoGetBestSize() const