- // If newlines are denoted by just 10, must stick 13 in front.
- int singletons = 0;
- int len = value.Length();
- int i;
- for (i = 0; i < len; i ++)
- {
- if ((i > 0) && (value[i] == 10) && (value[i-1] != 13))
- singletons ++;
- }
- if (singletons > 0)
- {
- wxChar *tmp = new wxChar[len + singletons + 1];
- int j = 0;
- for (i = 0; i < len; i ++)
- {
- if ((i > 0) && (value[i] == 10) && (value[i-1] != 13))
- {
- tmp[j] = 13;
- j ++;
- }
- tmp[j] = value[i];
- j ++;
- }
- tmp[j] = 0;
- SetWindowText(GetHwnd(), tmp);
- delete[] tmp;
- }
- else
- SetWindowText(GetHwnd(), value);
+ if ( HasFlag(wxCB_READONLY) )
+ SetStringSelection(value);
+ else
+ SetWindowText(GetHwnd(), value.c_str());