fix no response of Delete
This commit is contained in:
parent
9a5dfe7f88
commit
6a0fd78595
@ -157,8 +157,8 @@ namespace nana{ namespace widgets
|
|||||||
|
|
||||||
void set_accept(std::function<bool(char_type)>);
|
void set_accept(std::function<bool(char_type)>);
|
||||||
void set_accept(accepts);
|
void set_accept(accepts);
|
||||||
bool respone_char(char_type);
|
bool respond_char(char_type);
|
||||||
bool respone_key(char_type);
|
bool respond_key(char_type);
|
||||||
|
|
||||||
void typeface_changed();
|
void typeface_changed();
|
||||||
|
|
||||||
|
|||||||
@ -685,7 +685,7 @@ namespace nana
|
|||||||
{
|
{
|
||||||
case keyboard::os_arrow_left:
|
case keyboard::os_arrow_left:
|
||||||
case keyboard::os_arrow_right:
|
case keyboard::os_arrow_right:
|
||||||
drawer_->editor()->respone_key(arg.key);
|
drawer_->editor()->respond_key(arg.key);
|
||||||
drawer_->editor()->reset_caret();
|
drawer_->editor()->reset_caret();
|
||||||
break;
|
break;
|
||||||
case keyboard::os_arrow_up:
|
case keyboard::os_arrow_up:
|
||||||
@ -714,14 +714,14 @@ namespace nana
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (call_other_keys)
|
if (call_other_keys)
|
||||||
drawer_->editor()->respone_key(arg.key);
|
drawer_->editor()->respond_key(arg.key);
|
||||||
|
|
||||||
API::lazy_refresh();
|
API::lazy_refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
void trigger::key_char(graph_reference graph, const arg_keyboard& arg)
|
void trigger::key_char(graph_reference graph, const arg_keyboard& arg)
|
||||||
{
|
{
|
||||||
if (drawer_->editor()->respone_char(arg.key))
|
if (drawer_->editor()->respond_char(arg.key))
|
||||||
API::lazy_refresh();
|
API::lazy_refresh();
|
||||||
}
|
}
|
||||||
//end class trigger
|
//end class trigger
|
||||||
|
|||||||
@ -1326,7 +1326,7 @@ namespace nana{ namespace widgets
|
|||||||
attributes_.acceptive = acceptive;
|
attributes_.acceptive = acceptive;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool text_editor::respone_keyboard(char_type key) //key is a character of ASCII code
|
bool text_editor::respond_char(char_type key) //key is a character of ASCII code
|
||||||
{
|
{
|
||||||
switch (key)
|
switch (key)
|
||||||
{
|
{
|
||||||
@ -1377,6 +1377,24 @@ namespace nana{ namespace widgets
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool text_editor::respond_key(char_type key)
|
||||||
|
{
|
||||||
|
switch (key)
|
||||||
|
{
|
||||||
|
case keyboard::os_arrow_left: move_left(); break;
|
||||||
|
case keyboard::os_arrow_right: move_right(); break;
|
||||||
|
case keyboard::os_arrow_up: move_ns(true); break;
|
||||||
|
case keyboard::os_arrow_down: move_ns(false); break;
|
||||||
|
case keyboard::os_del:
|
||||||
|
if (this->attr().editable)
|
||||||
|
del();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
void text_editor::typeface_changed()
|
void text_editor::typeface_changed()
|
||||||
{
|
{
|
||||||
behavior_->pre_calc_lines(width_pixels());
|
behavior_->pre_calc_lines(width_pixels());
|
||||||
@ -2105,25 +2123,6 @@ namespace nana{ namespace widgets
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool text_editor::move(nana::char_t key)
|
|
||||||
{
|
|
||||||
switch(key)
|
|
||||||
{
|
|
||||||
case keyboard::os_arrow_left: move_left(); break;
|
|
||||||
case keyboard::os_arrow_right: move_right(); break;
|
|
||||||
case keyboard::os_arrow_up: move_ns(true); break;
|
|
||||||
case keyboard::os_arrow_down: move_ns(false); break;
|
|
||||||
case keyboard::os_del:
|
|
||||||
if (this->attr().editable)
|
|
||||||
del();
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void text_editor::move_ns(bool to_north)
|
void text_editor::move_ns(bool to_north)
|
||||||
{
|
{
|
||||||
const bool redraw_required = _m_cancel_select(0);
|
const bool redraw_required = _m_cancel_select(0);
|
||||||
|
|||||||
@ -559,7 +559,7 @@ namespace nana
|
|||||||
|
|
||||||
void drawer::key_press(graph_reference, const arg_keyboard& arg)
|
void drawer::key_press(graph_reference, const arg_keyboard& arg)
|
||||||
{
|
{
|
||||||
if (impl_->editor()->respone_key(arg.key))
|
if (impl_->editor()->respond_key(arg.key))
|
||||||
{
|
{
|
||||||
impl_->editor()->reset_caret();
|
impl_->editor()->reset_caret();
|
||||||
impl_->draw_spins();
|
impl_->draw_spins();
|
||||||
@ -569,7 +569,7 @@ namespace nana
|
|||||||
|
|
||||||
void drawer::key_char(graph_reference, const arg_keyboard& arg)
|
void drawer::key_char(graph_reference, const arg_keyboard& arg)
|
||||||
{
|
{
|
||||||
if (impl_->editor()->respone_char(arg.key))
|
if (impl_->editor()->respond_char(arg.key))
|
||||||
{
|
{
|
||||||
if (!impl_->value(impl_->editor()->text()))
|
if (!impl_->value(impl_->editor()->text()))
|
||||||
impl_->draw_spins();
|
impl_->draw_spins();
|
||||||
|
|||||||
@ -136,7 +136,7 @@ namespace drawerbase {
|
|||||||
|
|
||||||
void drawer::key_press(graph_reference, const arg_keyboard& arg)
|
void drawer::key_press(graph_reference, const arg_keyboard& arg)
|
||||||
{
|
{
|
||||||
if(editor_->respone_key(arg.key))
|
if(editor_->respond_key(arg.key))
|
||||||
{
|
{
|
||||||
editor_->reset_caret();
|
editor_->reset_caret();
|
||||||
API::lazy_refresh();
|
API::lazy_refresh();
|
||||||
@ -145,7 +145,7 @@ namespace drawerbase {
|
|||||||
|
|
||||||
void drawer::key_char(graph_reference, const arg_keyboard& arg)
|
void drawer::key_char(graph_reference, const arg_keyboard& arg)
|
||||||
{
|
{
|
||||||
if (editor_->respone_char(arg.key))
|
if (editor_->respond_char(arg.key))
|
||||||
API::lazy_refresh();
|
API::lazy_refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user