From: Stefan Neis <Stefan.Neis@t-online.de>
Date: Sun, 18 Jun 2006 19:31:07 +0000 (+0000)
Subject: Fixed sizer height and queried text length according to patch #1507207
X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/21a9132e92ebdf0f5ac71e984c47e030a3abdb16

Fixed sizer height and queried text length according to patch #1507207


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@39777 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
---

diff --git a/src/os2/choice.cpp b/src/os2/choice.cpp
index 9510b57188..0a2f5254f6 100644
--- a/src/os2/choice.cpp
+++ b/src/os2/choice.cpp
@@ -100,6 +100,14 @@ bool wxChoice::Create(
             ,rSize.x
             ,rSize.y
            );
+
+    // Set height to use with sizers i.e. without the dropdown listbox
+    wxFont vFont = GetFont();
+    int nCx,nCy;
+    wxGetCharSize( GetHWND(), &nCx, &nCy, &vFont );
+    int nEditHeight = EDIT_HEIGHT_FROM_CHAR_HEIGHT(nCy);
+    SetBestFittingSize(wxSize(-1,nEditHeight));
+
     return true;
 } // end of wxChoice::Create
 
@@ -242,7 +250,7 @@ wxString wxChoice::GetString(unsigned int n) const
     nLen = (size_t)LONGFROMMR(::WinSendMsg(GetHwnd(), LM_QUERYITEMTEXTLENGTH, (MPARAM)n, (MPARAM)0));
     if (nLen != LIT_ERROR && nLen > 0)
     {
-        zBuf = new wxChar[nLen + 1];
+        zBuf = new wxChar[++nLen];
         ::WinSendMsg( GetHwnd()
                      ,LM_QUERYITEMTEXT
                      ,MPFROM2SHORT((SHORT)n, (SHORT)nLen)