show that comboboxes do get char events now
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_2_BRANCH@7007 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -183,6 +183,28 @@ private:
|
|||||||
DECLARE_EVENT_TABLE()
|
DECLARE_EVENT_TABLE()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// a combo which intercepts chars (to test Windows behaviour)
|
||||||
|
class MyComboBox : public wxComboBox
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
MyComboBox(wxWindow *parent, wxWindowID id,
|
||||||
|
const wxString& value = wxEmptyString,
|
||||||
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
|
const wxSize& size = wxDefaultSize,
|
||||||
|
int n = 0, const wxString choices[] = NULL,
|
||||||
|
long style = 0,
|
||||||
|
const wxValidator& validator = wxDefaultValidator,
|
||||||
|
const wxString& name = wxComboBoxNameStr)
|
||||||
|
: wxComboBox(parent, id, value, pos, size, n, choices, style,
|
||||||
|
validator, name) { }
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void OnChar(wxKeyEvent& event);
|
||||||
|
|
||||||
|
private:
|
||||||
|
DECLARE_EVENT_TABLE()
|
||||||
|
};
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
// other
|
// other
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
@@ -387,6 +409,14 @@ EVT_BUTTON (ID_BUTTON_TEST2, MyPanel::OnTestButton)
|
|||||||
EVT_BUTTON (ID_BITMAP_BTN, MyPanel::OnBmpButton)
|
EVT_BUTTON (ID_BITMAP_BTN, MyPanel::OnBmpButton)
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
|
BEGIN_EVENT_TABLE(MyComboBox, wxComboBox)
|
||||||
|
EVT_CHAR(MyComboBox::OnChar)
|
||||||
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
|
// ============================================================================
|
||||||
|
// implementation
|
||||||
|
// ============================================================================
|
||||||
|
|
||||||
MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h )
|
MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h )
|
||||||
: wxPanel( frame, -1, wxPoint(x, y), wxSize(w, h) ),
|
: wxPanel( frame, -1, wxPoint(x, y), wxSize(w, h) ),
|
||||||
m_text(NULL), m_notebook(NULL)
|
m_text(NULL), m_notebook(NULL)
|
||||||
@@ -532,7 +562,8 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h )
|
|||||||
panel = new wxPanel(m_notebook);
|
panel = new wxPanel(m_notebook);
|
||||||
(void)new wxStaticBox( panel, -1, "&Box around combobox",
|
(void)new wxStaticBox( panel, -1, "&Box around combobox",
|
||||||
wxPoint(5, 5), wxSize(150, 100));
|
wxPoint(5, 5), wxSize(150, 100));
|
||||||
m_combo = new wxComboBox( panel, ID_COMBO, "This", wxPoint(20,25), wxSize(120,-1), 5, choices, wxCB_READONLY );
|
m_combo = new MyComboBox( panel, ID_COMBO, "This", wxPoint(20,25),
|
||||||
|
wxSize(120,-1), 5, choices); //, wxCB_READONLY );
|
||||||
(void)new wxButton( panel, ID_COMBO_SEL_NUM, "Select #&2", wxPoint(180,30), wxSize(140,30) );
|
(void)new wxButton( panel, ID_COMBO_SEL_NUM, "Select #&2", wxPoint(180,30), wxSize(140,30) );
|
||||||
(void)new wxButton( panel, ID_COMBO_SEL_STR, "&Select 'This'", wxPoint(340,30), wxSize(140,30) );
|
(void)new wxButton( panel, ID_COMBO_SEL_STR, "&Select 'This'", wxPoint(340,30), wxSize(140,30) );
|
||||||
(void)new wxButton( panel, ID_COMBO_CLEAR, "&Clear", wxPoint(180,80), wxSize(140,30) );
|
(void)new wxButton( panel, ID_COMBO_CLEAR, "&Clear", wxPoint(180,80), wxSize(140,30) );
|
||||||
@@ -1323,6 +1354,11 @@ void MyFrame::OnIdle( wxIdleEvent& WXUNUSED(event) )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MyComboBox::OnChar(wxKeyEvent& WXUNUSED(event))
|
||||||
|
{
|
||||||
|
wxLogMessage(_T("MyComboBox::OnChar"));
|
||||||
|
}
|
||||||
|
|
||||||
static void SetControlClientData(const char *name,
|
static void SetControlClientData(const char *name,
|
||||||
wxControlWithItems *control)
|
wxControlWithItems *control)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user