Following the tutorial at http://www.codersource.net/mfc/mfc-tutorials/ctabctrl.aspx , I have declared the function ActivateTabDialogs()
in my header file and called it inside another function in my class. The compiler gives error C2065: 'ActivateTabDialogs' : undeclared identifier
, at the line ActivateTabDialogs();
inside the definition of the function OnSelChange()
. What am I violating here?
Here's my declaration part in the header file TCGeriArama_TabCtrl.h
class CTCGeriArama_TabCtrl : public CTabCtrl
{
// Construction
public:
CTCGeriArama_TabCtrl();
// Attributes
//Array to hold the list of dialog boxes/tab pages for CTabCtrl
int m_DialogID[2];
int m_nPageCount;
//CDialog Array Variable to hold the dialogs
CDialog *m_Dialog[2];
public:
// Operations
//Function to Create the dialog boxes during startup
void InitDialogs();
//Function to activate the tab dialog boxes
void ActivateTabDialogs();
Here's the definition of ActivateTabDialogs()
and the part I'm calling it inside TCGeriArama_TabCtrl.cpp
void CTCGeriArama_TabCtrl::ActivateTabDialogs()
{
int nSel = GetCurSel();
if(m_Dialog[nSel]->m_hWnd)
m_Dialog[nSel]->ShowWindow(SW_HIDE);
CRect l_rectClient;
CRect l_rectWnd;
GetClientRect(l_rectClient);
AdjustRect(FALSE,l_rectClient);
GetWindowRect(l_rectWnd);
GetParent()->ScreenToClient(l_rectWnd);
l_rectClient.OffsetRect(l_rectWnd.left,l_rectWnd.top);
for(int nCount=0; nCount < m_nPageCount; nCount++){
m_Dialog[nCount]->SetWindowPos(&wndTop, l_rectClient.left, l_rectClient.top, l_rectClient.Width(), l_rectClient.Height(), SWP_HIDEWINDOW);
}
m_Dialog[nSel]->SetWindowPos(&wndTop, l_rectClient.left, l_rectClient.top, l_rectClient.Width(), l_rectClient.Height(), SWP_SHOWWINDOW);
m_Dialog[nSel]->ShowWindow(SW_SHOW);
}
//Selection change event for the class derived from CTabCtrl
void OnSelchange(NMHDR* pNMHDR, LRESULT* pResult)
{
// TODO: Add your control notification handler code here
ActivateTabDialogs(); // HERE'S WHERE THE COMPILER GIVES THE ERROR
*pResult = 0;
}
Thanks.