cpp/TextBox.cpp
changeset 4 a3d29fb016c3
child 5 f2a2f64eb682
equal deleted inserted replaced
3:01dafa022fa1 4:a3d29fb016c3
       
     1 #include <iostream>
       
     2 #include "TextBox.hpp"
       
     3 
       
     4 BEGIN_EVENT_TABLE (wxTextBox, wxTextCtrl)
       
     5     EVT_CHAR (wxTextBox::OnKeyEvent)
       
     6 END_EVENT_TABLE ()
       
     7 
       
     8 
       
     9 wxTextBox::wxTextBox(wxWindow *parent, int id, wxString text)
       
    10     :wxTextCtrl(parent, id, text, wxDefaultPosition, wxDefaultSize,
       
    11             wxTE_PROCESS_ENTER | wxTE_PROCESS_TAB)
       
    12 {
       
    13 }
       
    14 
       
    15 void wxTextBox::OnKeyEvent(wxKeyEvent &e)
       
    16 {
       
    17     if (e.GetKeyCode() == WXK_TAB)
       
    18     {
       
    19         std::cerr << "TAB pressed" << std::endl;
       
    20     }
       
    21     else if (e.GetKeyCode() == WXK_RETURN)
       
    22     {
       
    23         std::cerr << "ENTER pressed" << std::endl;
       
    24     }
       
    25     else
       
    26         e.Skip();
       
    27 }