- // If newlines are denoted by just 10, must stick 13 in front.
- 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))
- singletons ++;
- }
- if (singletons > 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] = 13;
- j ++;
- }
- tmp[j] = value[i];
- j ++;
- }
- if (GetWindowStyle() & wxCB_READONLY)
- SetStringSelection(tmp);
- else
- SetWindowText(GetHwnd(), tmp.c_str());
- }
- else
- if (GetWindowStyle() & wxCB_READONLY)
- SetStringSelection(value);