fix no response of Delete key

This commit is contained in:
Jinhao 2015-03-25 01:44:56 +08:00
parent 58b206cb93
commit 9a5dfe7f88
4 changed files with 16 additions and 8 deletions

View File

@ -157,7 +157,8 @@ namespace nana{ namespace widgets
void set_accept(std::function<bool(char_type)>);
void set_accept(accepts);
bool respone_keyboard(char_type);
bool respone_char(char_type);
bool respone_key(char_type);
void typeface_changed();
@ -227,7 +228,6 @@ namespace nana{ namespace widgets
void del();
void backspace(bool record_undo = true);
void undo(bool reverse);
bool move(nana::char_t);
void move_ns(bool to_north); //Moves up and down
void move_left();
void move_right();

View File

@ -677,6 +677,7 @@ namespace nana
if(!drawer_->widget_ptr()->enabled())
return;
bool call_other_keys = false;
if(drawer_->editable())
{
bool is_move_up = false;
@ -684,7 +685,7 @@ namespace nana
{
case keyboard::os_arrow_left:
case keyboard::os_arrow_right:
drawer_->editor()->move(arg.key);
drawer_->editor()->respone_key(arg.key);
drawer_->editor()->reset_caret();
break;
case keyboard::os_arrow_up:
@ -692,6 +693,8 @@ namespace nana
case keyboard::os_arrow_down:
drawer_->move_items(is_move_up, true);
break;
default:
call_other_keys = true;
}
}
else
@ -706,14 +709,19 @@ namespace nana
case keyboard::os_arrow_down:
drawer_->move_items(is_move_up, true);
break;
default:
call_other_keys = true;
}
}
if (call_other_keys)
drawer_->editor()->respone_key(arg.key);
API::lazy_refresh();
}
void trigger::key_char(graph_reference graph, const arg_keyboard& arg)
{
if (drawer_->editor()->respone_keyboard(arg.key))
if (drawer_->editor()->respone_char(arg.key))
API::lazy_refresh();
}
//end class trigger

View File

@ -559,7 +559,7 @@ namespace nana
void drawer::key_press(graph_reference, const arg_keyboard& arg)
{
if (impl_->editor()->move(arg.key))
if (impl_->editor()->respone_key(arg.key))
{
impl_->editor()->reset_caret();
impl_->draw_spins();
@ -569,7 +569,7 @@ namespace nana
void drawer::key_char(graph_reference, const arg_keyboard& arg)
{
if (impl_->editor()->respone_keyboard(arg.key))
if (impl_->editor()->respone_char(arg.key))
{
if (!impl_->value(impl_->editor()->text()))
impl_->draw_spins();

View File

@ -136,7 +136,7 @@ namespace drawerbase {
void drawer::key_press(graph_reference, const arg_keyboard& arg)
{
if(editor_->move(arg.key))
if(editor_->respone_key(arg.key))
{
editor_->reset_caret();
API::lazy_refresh();
@ -145,7 +145,7 @@ namespace drawerbase {
void drawer::key_char(graph_reference, const arg_keyboard& arg)
{
if (editor_->respone_keyboard(arg.key))
if (editor_->respone_char(arg.key))
API::lazy_refresh();
}