Article ID: 195238
Article Last Modified on 5/13/2003
int CMyEditCtlAppCtrl::OnMouseActivate(CWnd* pDesktopWnd,
UINT nHitTest, UINT message)
{
OnActivateInPlace (TRUE, NULL); // UI-Activate the control
return COleControl::OnMouseActivate(pDesktopWnd, nHitTest, message);
}
The second method changes the Visual Basic code. The only change that needs
to be made is to call the SetFocus method of one of the controls on the
form in the SSTab1_Click event handler. Then, after you click the SSTab
control, other controls on the form can get the input focus.
private:
CEdit m_Edit;
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
ON_WM_CREATE()
int CMyEditCtlAppCtrl::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
// Call the base class's OnCreate
if (COleControl::OnCreate(lpCreateStruct) == -1)
return -1;
// Create the edit control
CRect rClient;
CString strTemp = "";
GetClientRect(rClient);
m_Edit.Create(WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_OVERLAPPED |
WS_CLIPSIBLINGS | ES_MULTILINE | ES_WANTRETURN,
rClient, this, 123L);
m_Edit.SetWindowText(strTemp);
return 0;
}
virtual int OnMouseActivate(CWnd* pDesktopWnd, UINT nHitTest, UINT);
ON_WM_MOUSEACTIVATE()
int CMyEditCtlAppCtrl::OnMouseActivate(CWnd* pDesktopWnd,
UINT nHitTest, UINT message)
{
OnActivateInPlace (TRUE, NULL); //UI-Activate the control
return COleControl::OnMouseActivate(pDesktopWnd,
nHitTest, message);
}
Private Sub SSTab1_Click(PreviousTab As Integer)
MyEditCtlApp2.SetFocus
End Sub
Keywords: kbprb kbctrl kbcode KB195238