From 48d3f4f0441684b464cc6d1da132e74994faf4d5 Mon Sep 17 00:00:00 2001 From: Jinhao Date: Thu, 6 Dec 2018 07:41:02 +0800 Subject: [PATCH] fix bug that scrollbar steals input focus(#344) --- include/nana/gui/widgets/scroll.hpp | 3 +++ source/gui/widgets/skeletons/content_view.cpp | 2 -- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/include/nana/gui/widgets/scroll.hpp b/include/nana/gui/widgets/scroll.hpp index 0407095a..62857c6f 100644 --- a/include/nana/gui/widgets/scroll.hpp +++ b/include/nana/gui/widgets/scroll.hpp @@ -190,6 +190,9 @@ namespace nana widget_ = static_cast< ::nana::scroll*>(&widget); widget.caption("nana scroll"); + //scroll doesn't want the keyboard focus. + API::take_active(widget, false, widget.parent()); + timer_.stop(); timer_.elapse(std::bind(&trigger::_m_tick, this)); } diff --git a/source/gui/widgets/skeletons/content_view.cpp b/source/gui/widgets/skeletons/content_view.cpp index 0596b4c6..9c004f17 100644 --- a/source/gui/widgets/skeletons/content_view.cpp +++ b/source/gui/widgets/skeletons/content_view.cpp @@ -224,7 +224,6 @@ namespace nana { { cv_scroll->vert.create(window_handle); cv_scroll->vert.events().value_changed.connect_unignorable(event_fn); - API::take_active(cv_scroll->vert, false, window_handle); this->passive = false; } @@ -255,7 +254,6 @@ namespace nana { { cv_scroll->horz.create(window_handle); cv_scroll->horz.events().value_changed.connect_unignorable(event_fn); - API::take_active(cv_scroll->horz, false, window_handle); this->passive = false; }