EVT_LEFT_UP(wxComboListBox::OnLeftUp)
END_EVENT_TABLE()
-IMPLEMENT_DYNAMIC_CLASS2(wxComboBox, wxControl, wxComboCtrl)
-
// ============================================================================
// implementation
// ============================================================================
wxString wxComboBox::DoGetValue() const
{
- return wxComboCtrl::GetValue();
+ return GetTextCtrl() ? GetTextCtrl()->GetValue() : m_valueString;
}
void wxComboBox::SetValue(const wxString& value)
{
- wxComboCtrl::SetValue(value);
+ if ( GetTextCtrl() )
+ GetTextCtrl()->SetValue(value);
+ else
+ m_valueString = value;
}
void wxComboBox::WriteText(const wxString& value)
void wxComboBox::DoClear()
{
GetLBox()->Clear();
- if ( GetTextCtrl() ) GetTextCtrl()->SetValue(wxEmptyString);
+ SetValue(wxEmptyString);
}
void wxComboBox::DoDeleteOneItem(unsigned int n)
wxCHECK_RET( IsValid(n), wxT("invalid index in wxComboBox::Delete") );
if (GetSelection() == (int)n)
- if ( GetTextCtrl() ) GetTextCtrl()->SetValue(wxEmptyString);
+ SetValue(wxEmptyString);
GetLBox()->Delete(n);
}
int wxComboBox::GetSelection() const
{
-#if 1 // FIXME:: What is the correct behavior?
+#if 1 // FIXME:: What is the correct behaviour?
// if the current value isn't one of the listbox strings, return -1
return GetLBox()->GetSelection();
#else