const wxValidator& validator,
const wxString& name)
{
+ // pretend that wxComboBox is hidden while it is positioned and resized and
+ // show it only right before leaving this method because otherwise there is
+ // some noticeable flicker while the control rearranges itself
+ m_isShown = FALSE;
+
// first create wxWin object
if ( !CreateControl(parent, id, pos, size, style, validator, name) )
return FALSE;
// and now create the MSW control
- if ( !MSWCreateControl(_T("COMBOBOX"), msStyle, pos, size, wxEmptyString, (WXDWORD)-1, false) )
+ if ( !MSWCreateControl(_T("COMBOBOX"), msStyle) )
return FALSE;
// A choice/combobox normally has a white background (or other, depending
);
}
- // finally, show the combo box
- Show(true);
+ // and finally, show the control
+ Show(TRUE);
return TRUE;
}
void wxComboBox::SetValue(const wxString& value)
{
// If newlines are denoted by just 10, must stick 13 in front.
- int singletons = 0;
- int len = value.Length();
- int i;
+ size_t singletons = 0;
+ size_t len = value.Length();
+ size_t i;
for (i = 0; i < len; i ++)
{
if ((i > 0) && (value[i] == 10) && (value[i-1] != 13))
}
if (singletons > 0)
{
- wxChar *tmp = new wxChar[len + singletons + 1];
- int j = 0;
+ wxString tmp;
+ tmp.Alloc(len + singletons);
+ size_t j = 0;
for (i = 0; i < len; i ++)
{
if ((i > 0) && (value[i] == 10) && (value[i-1] != 13))
tmp[j] = value[i];
j ++;
}
- tmp[j] = 0;
- SetWindowText(GetHwnd(), tmp);
- delete[] tmp;
+ if (GetWindowStyle() & wxCB_READONLY)
+ SetStringSelection(tmp);
+ else
+ SetWindowText(GetHwnd(), tmp.c_str());
}
else
- SetWindowText(GetHwnd(), value);
+ if (GetWindowStyle() & wxCB_READONLY)
+ SetStringSelection(value);
+ else
+ SetWindowText(GetHwnd(), value.c_str());
}
// Clipboard operations