Re: Send message issue
Ajay,
I did not confirm from Spy++.
the debugger breaks at
mv->m_myCtrlTab->mydialog->m_ListCtrlTwo.SendMessage(WM_INSERT_ITEMS,0,0);
stating the window of is null.
Both these controls are sublcaased and I am missing anything and also
the Do Data Exchange of View also looks fine.
void CCView::DoDataExchange(CDataExchange* pDX)
{
CFormView::DoDataExchange(pDX);
DDX_Control(pDX, IDC_LIST_RESULTS, m_myListCtrlOne);
DDX_Control(pDX, IDC_TAB_CTRL, m_myCtrlTab);
}
I did not add DoDataExhange for TabCtrl -
but in tabctrl.h file i decalred the variables
CMyDaialog *userDlg;
Is this the problem?
in the DoDataExhange of CDialog
void CUserDataDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
DDX_Control(pDX, IDC_LIST_STUDY_SERIES, m_myListCtrlTwo);
}
in the view ,
i declared the variable sof listctrl and tabctrl only.
Is this the problem?
pls confirm
Ajay Kalra wrote:
Your code looks fine on both sides. Did you confirm that this message
is being sent by using Spy++? Also, how did you ensure that the message
is not being handled?
---
Ajay
nicetom786@yahoo.com wrote:
Ajay Kalra wrote:
You SendMessage code looks fine. How about the code on the subclassed
control side. Are you putting the appropriate message map to handle the
message. Also you should use Spy++ to see that the message is indeed
coming to the control.
----
Ajay
Hi Ajay,
Here is the code on the other side for Control1
CMyListCtrlOne.h
void CMyListCtrlOne::OnNMClick(NMHDR *pNMHDR, LRESULT *pResult)
{
CFrameWnd * pFrame = (CFrameWnd *)(AfxGetApp()->m_pMainWnd);
//now get the view from frame
CCView *mv = (CCView*)pFrame->GetActiveView();
mv->m_ListCtrlTwo.SendMessage(WM_INSERT_ITEMS,0,0);
}
Here is the code on the other side for Control2
subclassed control 2
CMyListCtrlTwo.h
afx_msg LRESULT OnInsertItemsinStudy(WPARAM,LPARAM);
CMyListCtrlTwo.cpp
BEGIN_MESSAGE_MAP(CMyListCtrlTwo, CListCtrl)
ON_MESSAGE(WM_INSERT_ITEMS,OnInsertItemsinStudy)
END_MESSAGE_MAP()
LRESULT CMyListCtrlTwo::OnInsertItemsinStudy(WPARAM,LPARAM)
{
AfxMessageBox(_TEXT("IN list ctrl two"),0,0);
return 1;
}