// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
- // Allows processing the tab key to go to the next control
- if (event.GetKeyCode() == WXK_TAB)
- {
- wxNavigationKeyEvent NavEvent;
- NavEvent.SetEventObject(this);
- NavEvent.SetDirection(true);
- NavEvent.SetWindowChange(false);
-
- // Get the parent of the combo and have it process the navigation?
- if (m_cb->GetParent()->GetEventHandler()->ProcessEvent(NavEvent))
+ // Allows processing the tab key to go to the next control
+ if (event.GetKeyCode() == WXK_TAB)
+ {
+ wxNavigationKeyEvent NavEvent;
+ NavEvent.SetEventObject(this);
+ NavEvent.SetDirection(true);
+ NavEvent.SetWindowChange(false);
+
+ // Get the parent of the combo and have it process the navigation?
+ if (m_cb->GetParent()->GetEventHandler()->ProcessEvent(NavEvent))
+ }
+
+ // send the event to the combobox class in case the user has bound EVT_CHAR
+ wxKeyEvent kevt(event);
+ kevt.SetEventObject(m_cb);
+ if (m_cb->GetEventHandler()->ProcessEvent(kevt))
+ // If the event was handled and not skipped then we're done
+ return;
+
if ( event.GetKeyCode() == WXK_RETURN )
{
wxCommandEvent event(wxEVT_COMMAND_TEXT_ENTER, m_cb->GetId());
if ( event.GetKeyCode() == WXK_RETURN )
{
wxCommandEvent event(wxEVT_COMMAND_TEXT_ENTER, m_cb->GetId());
- if ( event.GetKeyCode() != WXK_RETURN )
- {
- wxCommandEvent event(wxEVT_COMMAND_TEXT_UPDATED, m_cb->GetId());
- event.SetString( GetValue() );
- event.SetEventObject( m_cb );
- m_cb->GetEventHandler()->ProcessEvent(event);
- }
+ event.SetEventObject(m_cb);
+ event.SetId(m_cb->GetId());
+ if (! m_cb->GetEventHandler()->ProcessEvent(event))
+ event.Skip();
+ }
+
+ void OnKeyDown( wxKeyEvent& event )
+ {
+ event.SetEventObject(m_cb);
+ event.SetId(m_cb->GetId());
+ if (! m_cb->GetEventHandler()->ProcessEvent(event))
+ event.Skip();
- EVT_CHAR( wxComboBoxText::OnChar)
- EVT_KEY_UP( wxComboBoxText::OnKeyUp)
+ EVT_KEY_DOWN( wxComboBoxText::OnKeyDown)
+ EVT_CHAR( wxComboBoxText::OnChar)
+ EVT_KEY_UP( wxComboBoxText::OnKeyUp)
+ EVT_TEXT( -1, wxComboBoxText::OnText)
END_EVENT_TABLE()
class wxComboBoxChoice : public wxChoice
{
public:
wxComboBoxChoice(wxComboBox *cb, int style)
END_EVENT_TABLE()
class wxComboBoxChoice : public wxChoice
{
public:
wxComboBoxChoice(wxComboBox *cb, int style)
const wxString& name)
{
if ( !wxControl::Create(parent, id, wxDefaultPosition, wxDefaultSize, style ,
const wxString& name)
{
if ( !wxControl::Create(parent, id, wxDefaultPosition, wxDefaultSize, style ,
void wxComboBox::SetString(int n, const wxString& s)
{
m_choice->SetString( n , s ) ;
void wxComboBox::SetString(int n, const wxString& s)
{
m_choice->SetString( n , s ) ;