Re: Send message issue
you are right ,This is something with object creation.
I guess you missed it I sent you in the earlier mail.
However here it is.
Pls go though the 2 files
File 1 @@@@@@@@@@@@@@CCMView.cpp
I am initializing in onitailupdate of CView.....
void CCMView::OnInitialUpdate()
{
CFormView::OnInitialUpdate();
GetParentFrame()->RecalcLayout();
ResizeParentToFit();
//Insert Items in tab control
tcItem.pszText = _T("UserData");
m_myCtrlTab.InsertItem(0, &tcItem);
CUserDataDlg *tabUserData = new CUserDataDlg();
m_myCtrlTab.m_nNumberOfPages=1;
m_myCtrlTab.m_tabCurrent=0;
tabUserData->Create(IDD_DLG_USER_DATA,&m_myCtrlTab); //creating the
dialog
m_myCtrlTab.m_tabPages[0]= tabUserData ; //assigning to tab control
tabUserData->ShowWindow(SW_SHOW);
CRect rectArea;
m_myCtrlTab.GetWindowRect(rectArea);
for(int i = 0; i< 1;i++)
{
m_myCtrlTab.m_tabPages[i]->SetWindowPos( NULL, 9, 35, rectArea.Width()
- 18, rectArea.Height() - 44, SWP_NOZORDER | SWP_NOACTIVATE );
}
}
File 2 @@@@@@@@@@@@@@TabCtrl.h
In TabCtrl.h
---------------------
CDialog *m_tabPages[8];
----------------------------------------
pls correct me if am wrong .I know that I messed up by assigning to a
dialog array..
Ajay Kalra wrote:
You still have not shown where userDlg has been initialized/assigned.
That is the object in question that is causing problems.
----
Ajay
nicetom786@yahoo.com wrote:
Yes Jeff,
I think you are close to my problem
Here I assigned the in onitialupdate OF CFormView
m_myCtrlTab.m_tabPages[0]= tabUserData ;
where m_tabpages is an array of CDialog in tab control
and when I use this onNMClick of ListCtrlOne
mv->m_myCtrlTab.m_tabPages[0]->SendMessage(WM_INSERT_ITEMS,0,0);
i am able to handle the user message in tabUserData Dlg
When I use the
mv->m_myCtrlTab.userDlg->m_userLisTCtrl->SendMessage(WM_INSERT_ITEMS,0,0);
I am getting the same error message.
I think this is bad design .I will make Daialog to do something when I
get the message and while NM_CLICK etc will be handles by the
subclassed control ?
What say ?
Advise me for a good design.
thanks
Jeff Partch [MVP] wrote:
<nicetom786@yahoo.com> wrote in message
news:1149805675.981831.279300@g10g2000cwb.googlegroups.com...
David:
Its not the m_ListCtrlTwo that is null.
I
Its the dialog that I get assertion .
ASSERT_VALID(mv->m_myCtrlTab.userDlg);
and goes to objcore.cpp line no 90
// check to make sure the VTable pointer is valid
ASSERT(sizeof(CObject) == sizeof(void*));
if (!AfxIsValidAddress(*(void**)pOb, sizeof(void*), FALSE))
{
TRACE(traceAppMsg, 0, "ASSERT_VALID fails with illegal
vtable
pointer.\n");
if (AfxAssertFailedLine(lpszFileName, nLine))
AfxDebugBreak();
return; // quick escape
}
Both the view and the tabcontrol are valid.
userDlg is a CDialog class inside the tab control.
userdialog was created in the onitialupdate of CFormview
CUserDataDlg *tabUserData = new CUserDataDlg();
m_myCtrlTab.m_nNumberOfPages=1;
m_myCtrlTab.m_tabCurrent=0;
tabUserData->Create(IDD_DLG_USER_DATA,&m_myCtrlTab);
Show how userDlg is or refers to the same object as tabUserData.
--
Jeff Partch [VC++ MVP]