From 0770a68dd031c77a7f4be169e20ba6318668fb2a Mon Sep 17 00:00:00 2001 From: unodgs Date: Sun, 26 Jun 2011 11:09:08 +0000 Subject: [PATCH] GridCtrl: Fixed loosing focus when typing in find box. Added calling WhenSearchCursor on clearing search string git-svn-id: svn://ultimatepp.org/upp/trunk@3565 f0d560ea-af0d-0410-9eb7-867de7ffcac7 --- uppsrc/GridCtrl/GridCtrl.cpp | 10 +++++++--- uppsrc/GridCtrl/GridCtrl.h | 21 +++++++++++---------- 2 files changed, 18 insertions(+), 13 deletions(-) diff --git a/uppsrc/GridCtrl/GridCtrl.cpp b/uppsrc/GridCtrl/GridCtrl.cpp index c51321a03..d8993701a 100644 --- a/uppsrc/GridCtrl/GridCtrl.cpp +++ b/uppsrc/GridCtrl/GridCtrl.cpp @@ -4631,6 +4631,8 @@ void GridCtrl::UpdateCtrls(int opt /*= UC_CHECK_VIS | UC_SHOW | UC_CURSOR */) edit_ctrls = false; + bool nofocus = opt & UC_NOFOCUS; + focused_ctrl = NULL; focused_ctrl_id = -1; focused_col = -1; @@ -4671,7 +4673,7 @@ void GridCtrl::UpdateCtrls(int opt /*= UC_CHECK_VIS | UC_SHOW | UC_CURSOR */) gofirst = false; } - bool dofocus = !(opt & UC_HIDE) && dorf; + bool dofocus = !nofocus && !(opt & UC_HIDE) && dorf; if(show) { @@ -4712,7 +4714,7 @@ void GridCtrl::UpdateCtrls(int opt /*= UC_CHECK_VIS | UC_SHOW | UC_CURSOR */) } } - if(!focused_ctrl) + if(!nofocus && !focused_ctrl) SetFocus(); if(opt & UC_CTRLS) @@ -7611,6 +7613,8 @@ void GridCtrl::ClearFound(bool showrows, bool clear_string) if(clear_string) search_string.Clear(); + + WhenSearchCursor(); } bool GridCtrl::Match(const WString &f, const WString &s, int &fs, int &fe) @@ -7648,7 +7652,7 @@ bool GridCtrl::Match(const WString &f, const WString &s, int &fs, int &fe) void GridCtrl::DoFind() { - UpdateCtrls(UC_CHECK_VIS | UC_HIDE | UC_CTRLS | UC_SCROLL); + UpdateCtrls(UC_CHECK_VIS | UC_HIDE | UC_CTRLS | UC_SCROLL | UC_NOFOCUS); ShowMatchedRows((WString) ~find); } diff --git a/uppsrc/GridCtrl/GridCtrl.h b/uppsrc/GridCtrl/GridCtrl.h index 42e97d8ce..7601a18f3 100644 --- a/uppsrc/GridCtrl/GridCtrl.h +++ b/uppsrc/GridCtrl/GridCtrl.h @@ -291,16 +291,17 @@ class GridCtrl : public Ctrl UC_SHOW = BIT(0), UC_HIDE = BIT(1), UC_FOCUS = BIT(2), - UC_GOFIRST = BIT(3), - UC_SCROLL = BIT(4), - UC_NEXT = BIT(5), - UC_CTRLS = BIT(6), - UC_CURSOR = BIT(7), - UC_CHECK_VIS = BIT(8), - UC_MOUSE = BIT(9), - UC_CTRLS_OFF = BIT(10), - UC_UPDATES = BIT(11), - UC_OLDCUR = BIT(12) + UC_NOFOCUS = BIT(3), + UC_GOFIRST = BIT(4), + UC_SCROLL = BIT(5), + UC_NEXT = BIT(6), + UC_CTRLS = BIT(7), + UC_CURSOR = BIT(8), + UC_CHECK_VIS = BIT(9), + UC_MOUSE = BIT(10), + UC_CTRLS_OFF = BIT(11), + UC_UPDATES = BIT(12), + UC_OLDCUR = BIT(13) }; enum GridRepaintOpts