From 0d521e0bca5f9f7241a06528d76f703714fa75d4 Mon Sep 17 00:00:00 2001
From: samatov.nail <samatov@developers.mail>
Date: Mon, 13 Dec 2010 20:20:18 +0300
Subject: [PATCH] fix losing of the focus in Find/Replace dialog if nothing is found

---
 pgadmin/ctl/ctlSQLBox.cpp |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/pgadmin/ctl/ctlSQLBox.cpp b/pgadmin/ctl/ctlSQLBox.cpp
index 55428f1..c58a6c0 100644
--- a/pgadmin/ctl/ctlSQLBox.cpp
+++ b/pgadmin/ctl/ctlSQLBox.cpp
@@ -204,7 +204,8 @@ bool ctlSQLBox::Find(const wxString &find, bool wholeWord, bool matchCase, bool
 {
     if (!DoFind(find, wxString(wxEmptyString), false, wholeWord, matchCase, useRegexps, startAtTop, reverse))
     {
-        wxMessageBox(_("Reached the end of the document"), _("Find text"), wxICON_EXCLAMATION | wxOK, this);
+		wxWindow * w = wxWindow::FindFocus();
+        wxMessageBox(_("Reached the end of the document"), _("Find text"), wxICON_EXCLAMATION | wxOK, w);
         return false;
     }
     return true;
@@ -214,7 +215,8 @@ bool ctlSQLBox::Replace(const wxString &find, const wxString &replace, bool whol
 {
     if (!DoFind(find, replace, true, wholeWord, matchCase, useRegexps, startAtTop, reverse))
     {
-        wxMessageBox(_("Reached the end of the document"), _("Replace text"), wxICON_EXCLAMATION | wxOK, this);
+		wxWindow * w = wxWindow::FindFocus();
+        wxMessageBox(_("Reached the end of the document"), _("Replace text"), wxICON_EXCLAMATION | wxOK, w);
         return false;
     }
     return true;
-- 
1.7.3.1.msysgit.0

