Article ID: 108434
Article Last Modified on 11/21/2006
if (pOldActiveView == pParent->GetActiveView())
{
pParent->SetActiveView(pOldActiveView); // Re-activate.
if (pOldActiveView != NULL)
pOldActiveView->SetFocus(); // Make sure focus is restored.
}
You can include this fix into WINSPLIT.CPP and then rebuild the MFC library
by following the directions in Appendix B of the "Class Libraries User's
Guide" as well as the README.TXT file located in the \MSVC\MFC\SRC
directory.
class CMySplit:public CSplitterWnd // derive from it.
{
public:
// This is the pointer to the window that
// has focus when the splitter starts resizing.
HWND hWndFocus;
// ...rest of your declaration.
}
void CMySplit::OnLButtonDown(UINT nFlags, CPoint point)
{
//Get CWnd with current focus
hWndFocus = ::GetFocus();
// Remember to call the base class handler.
CSplitterWnd::OnLButtonDown(nFlags,point);
}
void CMySplit::OnLButtonUp(UINT nFlags, CPoint point)
{
//restore focus
::SetFocus(hWndFocus);
// Remember to call the base class handler.
CSplitterWnd::OnLButtonUp(nFlags,point);
}
The code above assumes that the focus is being set to one of the windows in
the splitter window panes before the OnLButtonDown() handler is called.
That is, you probably wouldn't want to set the focus back to some other
window outside of the splitter window when the mouse button is released.
You could write additional code to check to see if the focus is set to a
window in one of the panes by checking the splitter's frame window's
m_pActiveView variable.
Additional query words: 1.00 2.00 2.10 splitter focus kbNoUpdate
Keywords: kbbug kbfix kbuidesign KB108434