When I debug and step into the function CGrid::Left, in one case it returns 1 if pReturn is not equal to NULL and pReturn->m_bActive is TRUE.Code:CWordBox *pReturn; I am calling CGrid::Left(CWordBox* pWordBox, CWordBox* pReturn) as below: switch(nChar) { case VK_LEFT: { m_pGrid->Left(this, pReturn); if(pReturn != NULL) { pReturn->SetFocus(); } } break; The implementation of CGrid::Left is as below int CGrid::Left(CWordBox* pWordBox, CWordBox* pReturn) { CPoint Point; Point.x = pWordBox->m_Rect.TopLeft().x - 10; Point.y = pWordBox->m_Rect.TopLeft().y + 10; if(pWordBox->m_Rect.TopLeft().x == 0) return BORDER; else { pReturn = FindBox(Point); if(pReturn == NULL || !pReturn->m_bActive) { pReturn = NULL; return NULL; } else return 1; } return NULL; }
But when I reach here:
m_pGrid->Left(this, pReturn);
if(pReturn != NULL)
{
pReturn->SetFocus();
}
pReturn is always NULL even when pReturn was valid pointer inside CGrid::Left(...).
How can I solve this problems.
Please Help
Any help will be appreciated greatly.




Reply With Quote