}
break;
-#if 0
case WM_GETDLGCODE:
{
wxCHECK_MSG( win, 0, _T("should have a parent") );
}
}
break;
-#endif // 0
// deal with tooltips here
#if wxUSE_TOOLTIPS && defined(TTN_NEEDTEXT)
event.SetString(value);
event.SetEventObject(this);
- return ProcessCommand(event);
+ ProcessCommand(event);
}
break;
}
- // I don't think the following should be true. The return value is
- // whether the event has been handled, not the status of the handling.
- // So, we only return false if the switch fell through. This will
- // resolve the same event being sent multiple times by MS Windows.
- // mea 05-22-01
-
// there is no return value for the CBN_ notifications, so always return
// FALSE from here to pass the message to DefWindowProc()
return FALSE;
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 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