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
This commit is contained in:
unodgs 2011-06-26 11:09:08 +00:00
parent c77a4b7b6a
commit 0770a68dd0
2 changed files with 18 additions and 13 deletions

View file

@ -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);
}

View file

@ -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