- int currentX, currentY;
- GetPosition(¤tX, ¤tY);
-
- int x1 = x;
- int y1 = y;
- int w1 = width;
- int h1 = height;
-
- if (x == -1 || (sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
- x1 = currentX;
- if (y == -1 || (sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
- y1 = currentY;
-
- // If we're prepared to use the existing size, then...
- if (width == -1 && height == -1 && ((sizeFlags & wxSIZE_AUTO) != wxSIZE_AUTO))
- {
- GetSize(&w1, &h1);
- }
-
- int cx; // button font dimensions
- int cy;
- wxGetCharSize(GetHWND(), &cx, &cy, GetFont());
-
- float control_width, control_height;
-
- // Ignore height parameter because height doesn't
- // mean 'initially displayed' height, it refers to the
- // drop-down menu as well. The wxWindows interpretation
- // is different; also, getting the size returns the
- // _displayed_ size (NOT the drop down menu size)
- // so setting-getting-setting size would not work.
- h1 = -1;
-
- // Deal with default size (using -1 values)
- if (width <= 0)
- {
- // Find the longest string
- if (no_strings == 0)
- control_width = (float)100.0;
- else
- {
- float len, ht;
- float longest = (float)0.0;
- int i;
- for (i = 0; i < no_strings; i++)
- {
- wxString str(GetString(i));
- GetTextExtent(str, &len, &ht, NULL, NULL,GetFont());
- if ( len > longest) longest = len;
- }
+ size_t len = (size_t)::SendMessage(GetHwnd(), CB_GETLBTEXTLEN, n, 0);
+ wxString str;
+ if (len) {
+ if ( ::SendMessage(GetHwnd(), CB_GETLBTEXT, n,
+ (LPARAM)str.GetWriteBuf(len)) == CB_ERR ) {
+ wxLogLastError(wxT("SendMessage(CB_GETLBTEXT)"));
+ }
+ str.UngetWriteBuf();
+ }
+
+ return str;
+}