From 8899cc870c6a60ab87a46beabf4808e3eb232ab9 Mon Sep 17 00:00:00 2001 From: beru Date: Thu, 21 May 2015 04:15:20 +0900 Subject: [PATCH] Deselect textbox contents on mouse_down event. Add the condition that textbox's content should be selected when it's focused with tabstop. --- source/gui/widgets/skeletons/text_editor.cpp | 3 +++ source/gui/widgets/textbox.cpp | 12 ++++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/source/gui/widgets/skeletons/text_editor.cpp b/source/gui/widgets/skeletons/text_editor.cpp index 9489c8f4..3031e6ca 100644 --- a/source/gui/widgets/skeletons/text_editor.cpp +++ b/source/gui/widgets/skeletons/text_editor.cpp @@ -1629,7 +1629,10 @@ namespace nana{ namespace widgets select_.mode_selection = selection::mode_mouse_selected; } else + { + select(false); select_.mode_selection = selection::mode_no_selected; + } } text_area_.border_renderer(graph_, _m_bgcolor()); diff --git a/source/gui/widgets/textbox.cpp b/source/gui/widgets/textbox.cpp index 13c68a26..ab443cbe 100644 --- a/source/gui/widgets/textbox.cpp +++ b/source/gui/widgets/textbox.cpp @@ -15,6 +15,9 @@ #include #include +#include +#include + namespace nana { arg_textbox::arg_textbox(textbox& wdg) @@ -90,8 +93,13 @@ namespace drawerbase { { refresh(graph); if (arg.getting) { - editor_->select(true); - editor_->move_caret_end(); + static auto& brock = detail::bedrock::instance(); + auto native_window = reinterpret_cast(arg.receiver); + auto* root_runtime = brock.wd_manager.root_runtime(native_window); + if (root_runtime && root_runtime->condition.tabstop_focus_changed) { + editor_->select(true); + editor_->move_caret_end(); + } } editor_->show_caret(arg.getting); editor_->reset_caret();