first_row(0),
visible_rows(1),
text_part(0),
- slider(0)
+ slider(0),
+ got_key_press(false)
{
set_text(t);
}
void Entry::key_press(unsigned key, unsigned)
{
+ got_key_press = true;
if(key==Input::KEY_LEFT)
{
if(edit_pos>0)
void Entry::character(wchar_t ch)
{
- if(ch>=' ')
+ if(got_key_press && ch>=' ')
{
text.insert(edit_pos, StringCodec::encode<StringCodec::Utf8>(StringCodec::ustring(1, ch)));
++edit_pos;
}
}
+void Entry::focus_out()
+{
+ Widget::focus_out();
+ got_key_press = false;
+}
+
void Entry::on_geometry_change()
{
reposition_slider();