the modal dialogs restore the focus to the control which had it before the

dialog was displayed (earlier, the focus was lost all the time)


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@465 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
1998-08-07 22:27:33 +00:00
parent a02eb1d2b6
commit dc1c4b6213
2 changed files with 58 additions and 51 deletions

View File

@@ -111,6 +111,9 @@ public:
virtual WXHBRUSH OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor,
WXUINT message, WXWPARAM wParam, WXLPARAM lParam);
protected:
WXHWND m_hwndOldFocus; // the window which had focus before we were shown
DECLARE_EVENT_TABLE()
};

View File

@@ -59,7 +59,7 @@ END_EVENT_TABLE()
long wxDialog::MSWDefWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam)
{
return ::CallWindowProc(CASTWNDPROC (FARPROC) m_oldWndProc, (HWND) GetHWND(), (UINT) nMsg, (WPARAM) wParam, (LPARAM) lParam);
return ::CallWindowProc((FARPROC)m_oldWndProc, (HWND) GetHWND(), (UINT) nMsg, (WPARAM) wParam, (LPARAM) lParam);
}
bool wxDialog::MSWProcessMessage(WXMSG* pMsg)
@@ -309,6 +309,8 @@ bool wxDialog::Show(bool show)
{
if (show)
{
m_hwndOldFocus = (WXHWND)::GetFocus();
wxList DisabledWindows;
if (m_modalShowing)
{
@@ -375,8 +377,10 @@ bool wxDialog::Show(bool show)
node=node->Next();
}
}
else
else // !show
{
::SetFocus((HWND)m_hwndOldFocus);
wxModalDialogs.DeleteObject(this);
wxNode *last = wxModalDialogs.Last();
@@ -416,7 +420,7 @@ bool wxDialog::Show(bool show)
m_modalShowing = FALSE;
}
}
else
else // !modal
{
if (show)
{