--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/cpp/TextBox.cpp Sun Feb 13 08:27:44 2011 +0100
@@ -0,0 +1,27 @@
+#include <iostream>
+#include "TextBox.hpp"
+
+BEGIN_EVENT_TABLE (wxTextBox, wxTextCtrl)
+ EVT_CHAR (wxTextBox::OnKeyEvent)
+END_EVENT_TABLE ()
+
+
+wxTextBox::wxTextBox(wxWindow *parent, int id, wxString text)
+ :wxTextCtrl(parent, id, text, wxDefaultPosition, wxDefaultSize,
+ wxTE_PROCESS_ENTER | wxTE_PROCESS_TAB)
+{
+}
+
+void wxTextBox::OnKeyEvent(wxKeyEvent &e)
+{
+ if (e.GetKeyCode() == WXK_TAB)
+ {
+ std::cerr << "TAB pressed" << std::endl;
+ }
+ else if (e.GetKeyCode() == WXK_RETURN)
+ {
+ std::cerr << "ENTER pressed" << std::endl;
+ }
+ else
+ e.Skip();
+}