diff --git a/include/nana/gui/basis.hpp b/include/nana/gui/basis.hpp index a13b3bac..69b97c1f 100644 --- a/include/nana/gui/basis.hpp +++ b/include/nana/gui/basis.hpp @@ -91,6 +91,8 @@ namespace nana substitute = 0x1A, //Ctrl+Z escape = 0x1B, space = 0x20, //Space + del = 0x7F, //Delete + os_del = del, //Deprecated //The following names are intuitive name of ASCII control codes select_all = start_of_headline, @@ -106,8 +108,8 @@ namespace nana os_ctrl = 0x11, os_pageup = 0x21, os_pagedown, os_arrow_left = 0x25, os_arrow_up, os_arrow_right, os_arrow_down, - os_insert = 0x2D, os_del , - os_end = 0x23 , os_home //Pos 1 + os_insert = 0x2D, + os_end = 0x23, os_home //Pos 1 }; }; diff --git a/source/gui/detail/bedrock_posix.cpp b/source/gui/detail/bedrock_posix.cpp index 9b0e24e0..4e7c8a07 100644 --- a/source/gui/detail/bedrock_posix.cpp +++ b/source/gui/detail/bedrock_posix.cpp @@ -438,8 +438,8 @@ namespace detail keysym = keyboard::os_arrow_left + (keysym - XK_Left); break; case XK_Insert: keysym = keyboard::os_insert; break; - case XK_Delete: - keysym = keyboard::os_del; break; + case XK_Delete: case XK_KP_Delete: + keysym = keyboard::del; break; case XK_Shift_L: case XK_Shift_R: //shift keysym = keyboard::os_shift; break; case XK_Control_L: case XK_Control_R: //ctrl diff --git a/source/gui/detail/bedrock_windows.cpp b/source/gui/detail/bedrock_windows.cpp index ebf32705..67f40ffe 100644 --- a/source/gui/detail/bedrock_windows.cpp +++ b/source/gui/detail/bedrock_windows.cpp @@ -775,6 +775,19 @@ namespace detail if (thrd) thrd->event_window = prev_event_wd; } + //Translate OS Virtual-Key into ASCII code + wchar_t translate_virtual_key(WPARAM vkey) + { + switch (vkey) + { + case VK_DELETE: + return 127; + case VK_DECIMAL: + return 46; + } + return static_cast(vkey); + } + LRESULT CALLBACK Bedrock_WIN32_WindowProc(HWND root_window, UINT message, WPARAM wParam, LPARAM lParam) { LRESULT window_proc_value = 0; @@ -1436,7 +1449,7 @@ namespace detail arg.evt_code = event_code::key_press; arg.window_handle = reinterpret_cast(msgwnd); arg.ignore = false; - arg.key = static_cast(wParam); + arg.key = translate_virtual_key(wParam); brock.get_key_state(arg); brock.emit(event_code::key_press, msgwnd, arg, true, &context); @@ -1522,7 +1535,7 @@ namespace detail arg_keyboard arg; arg.evt_code = event_code::key_release; arg.window_handle = reinterpret_cast(msgwnd); - arg.key = static_cast(wParam); + arg.key = translate_virtual_key(wParam); brock.get_key_state(arg); arg.ignore = false; brock.emit(event_code::key_release, msgwnd, arg, true, &context); diff --git a/source/gui/widgets/skeletons/text_editor.cpp b/source/gui/widgets/skeletons/text_editor.cpp index 5688b2be..72cec7ee 100644 --- a/source/gui/widgets/skeletons/text_editor.cpp +++ b/source/gui/widgets/skeletons/text_editor.cpp @@ -1233,7 +1233,7 @@ namespace nana{ namespace widgets case keyboard::os_pagedown: _m_handle_move_key(arg); break; - case keyboard::os_del: + case keyboard::del: // send delete to set_accept function if (this->attr().editable && (!impl_->capacities.pred_acceptive || impl_->capacities.pred_acceptive(key))) del();