#include "wx/textctrl.h"
#include "wx/checkbox.h"
#include "wx/combobox.h"
- #include "wx/valtext.h"
#include "wx/intl.h"
#include "wx/math.h"
#include "wx/listbox.h"
#endif
+#include "wx/valnum.h"
#include "wx/textfile.h"
#include "wx/spinctrl.h"
#include "wx/tokenzr.h"
return false;
#if wxUSE_UNICODE
- if ( event.GetUnicodeKey() == WXK_NONE )
+ if ( static_cast<int>(event.GetUnicodeKey()) == WXK_NONE )
return false;
#else
if ( event.GetKeyCode() > WXK_START )
// a valid character, so not a whole lot of testing needs to be done.
wxTextCtrl* tc = Text();
- wxChar ch;
- long pos;
+ int ch;
bool isPrintable;
else
#endif // wxUSE_UNICODE
{
- ch = (wxChar)event.GetKeyCode();
+ ch = event.GetKeyCode();
isPrintable = ch >= WXK_SPACE && ch < WXK_START;
}
switch (ch)
{
case WXK_DELETE:
- // delete the character at the cursor
- pos = tc->GetInsertionPoint();
- if (pos < tc->GetLastPosition())
- tc->Remove(pos, pos + 1);
+ // Delete the initial character when starting to edit with DELETE.
+ tc->Remove(0, 1);
break;
case WXK_BACK:
- // delete the character before the cursor
- pos = tc->GetInsertionPoint();
- if (pos > 0)
+ // Delete the last character when starting to edit with BACKSPACE.
+ {
+ const long pos = tc->GetLastPosition();
tc->Remove(pos - 1, pos);
+ }
break;
default:
if ( isPrintable )
- tc->WriteText(ch);
+ tc->WriteText(static_cast<wxChar>(ch));
break;
}
}
wxGridCellTextEditor::Create(parent, id, evtHandler);
#if wxUSE_VALIDATORS
- Text()->SetValidator(wxTextValidator(wxFILTER_NUMERIC));
+ Text()->SetValidator(wxIntegerValidator<int>());
#endif
}
}
wxGridCellTextEditor::Create(parent, id, evtHandler);
#if wxUSE_VALIDATORS
- Text()->SetValidator(wxTextValidator(wxFILTER_NUMERIC));
+ Text()->SetValidator(wxFloatingPointValidator<double>(m_precision));
#endif
}
}
Combo()->SetSelection(m_index);
- Combo()->SetInsertionPointEnd();
Combo()->SetFocus();
}